stop threading email and password around as arguments
This commit is contained in:
parent
03995ca922
commit
bc47154895
|
@ -3,6 +3,9 @@ let
|
|||
lib = pkgs.lib;
|
||||
rebuildableTest = import ./rebuildableTest.nix pkgs;
|
||||
|
||||
email = "test@test.com";
|
||||
password = "testtest";
|
||||
|
||||
# FIXME: Replace all the By.XPATH by By.CSS_SELECTOR.
|
||||
|
||||
seleniumImports = ''
|
||||
|
@ -22,7 +25,7 @@ let
|
|||
driver.set_window_size(1280, 960)
|
||||
'';
|
||||
|
||||
seleniumPixelfedLogin = email: password: ''
|
||||
seleniumPixelfedLogin = ''
|
||||
print("Open login page...", file=sys.stderr)
|
||||
driver.get("http://pixelfed.localhost/login")
|
||||
print("Enter email...", file=sys.stderr)
|
||||
|
@ -56,7 +59,7 @@ let
|
|||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
|
||||
${seleniumSetup}
|
||||
${seleniumPixelfedLogin "sys.argv[1]" "sys.argv[2]"}
|
||||
${seleniumPixelfedLogin}
|
||||
time.sleep(3)
|
||||
|
||||
media_path = os.environ['POST_MEDIA']
|
||||
|
@ -95,7 +98,7 @@ let
|
|||
} ''
|
||||
${seleniumImports}
|
||||
${seleniumSetup}
|
||||
${seleniumPixelfedLogin "sys.argv[1]" "sys.argv[2]"}
|
||||
${seleniumPixelfedLogin}
|
||||
|
||||
img = driver.find_element(
|
||||
By.XPATH,
|
||||
|
@ -169,8 +172,7 @@ pkgs.nixosTest {
|
|||
server.wait_for_unit("phpfpm-pixelfed.service")
|
||||
|
||||
with subtest("Account creation"):
|
||||
password = "testtest"
|
||||
server.succeed(f"pixelfed-manage user:create --name=test --username=test --email=test@test.com --password={password} --confirm_email=1")
|
||||
server.succeed(f"pixelfed-manage user:create --name=test --username=test --email=${email} --password=${password} --confirm_email=1")
|
||||
|
||||
# NOTE: This could in theory give a false positive if pixelfed changes it's
|
||||
# colorscheme to include pure green. (see same problem in pixelfed-garage.nix).
|
||||
|
@ -178,7 +180,7 @@ pkgs.nixosTest {
|
|||
# there, then post a green image and check that the green pixel IS there.
|
||||
|
||||
with subtest("Image displays"):
|
||||
server.succeed(f"su - selenium -c 'selenium-script-post-picture test@test.com {password}'")
|
||||
server.succeed(f"su - selenium -c 'selenium-script-post-picture ${email} ${password}'")
|
||||
server.copy_from_vm("/home/selenium/screenshot.png", "")
|
||||
displayed_colors = server.succeed("magick /home/selenium/screenshot.png -define histogram:unique-colors=true -format %c histogram:info:")
|
||||
# check that the green image displayed somewhere
|
||||
|
@ -202,7 +204,7 @@ pkgs.nixosTest {
|
|||
raise Exception("image stored in garage did not match image uploaded")
|
||||
|
||||
with subtest("Check that image comes from garage"):
|
||||
src = server.succeed(f"su - selenium -c 'selenium-script-get-src test@test.com {password}'")
|
||||
src = server.succeed(f"su - selenium -c 'selenium-script-get-src ${email} ${password}'")
|
||||
if not src.startswith("http://pixelfed.web.garage.localhost:3902/"):
|
||||
raise Exception("image does not come from garage")
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue