1 import ./make-test-python.nix (
5 # this is a demo user created by IDM_CREATE_DEMO_USERS=true
7 demoPassword = "relativity";
10 adminPassword = "hunter2";
12 pkgs.writers.writePython3Bin "test-runner"
14 libraries = [ pkgs.python3Packages.selenium ];
15 flakeIgnore = [ "E501" ];
19 from selenium.webdriver.common.by import By
20 from selenium.webdriver import Firefox
21 from selenium.webdriver.firefox.options import Options
22 from selenium.webdriver.support.ui import WebDriverWait
23 from selenium.webdriver.support import expected_conditions as EC
26 options.add_argument('--headless')
27 driver = Firefox(options=options)
30 password = sys.argv[2]
31 driver.implicitly_wait(20)
32 driver.get('https://localhost:9200/login')
33 wait = WebDriverWait(driver, 10)
34 wait.until(EC.title_contains("Sign in"))
35 driver.find_element(By.XPATH, '//*[@id="oc-login-username"]').send_keys(user)
36 driver.find_element(By.XPATH, '//*[@id="oc-login-password"]').send_keys(password)
37 driver.find_element(By.XPATH, '//*[@id="root"]//button').click()
38 wait.until(EC.title_contains("Personal"))
41 # This was generated with `ocis init --config-path testconfig/ --admin-password "hunter2" --insecure true`.
44 jwt_secret: kaKYgfso*d9GA-yTM.&BTOUEuMz%Ai0H
45 machine_auth_api_key: sGWRG1JZ&qe&pe@N1HKK4#qH*B&@xLnO
46 system_user_api_key: h+m4aHPUtOtUJFKrc5B2=04C=7fDZaT-
47 transfer_secret: 4-R6AfUjQn0P&+h2+$skf0lJqmre$j=x
48 system_user_id: db180e0a-b38a-4edf-a4cd-a3d358248537
49 admin_user_id: ea623f50-742d-4fd0-95bb-c61767b070d4
52 id: 11971eab-d560-4b95-a2d4-50726676bbd0
59 bind_password: ^F&Vn7@mYGYGuxr$#qm^gGy@FVq=.w=y
61 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
62 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
65 bind_password: bv53IjS28x.nxth*%aRbE70%4TGNXbLU
67 service_user_passwords:
68 admin_password: hunter2
69 idm_password: ^F&Vn7@mYGYGuxr$#qm^gGy@FVq=.w=y
70 reva_password: z-%@fWipLliR8lD#fl.0teC#9QbhJ^eb
71 idp_password: bv53IjS28x.nxth*%aRbE70%4TGNXbLU
75 insecure_backends: true
77 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
78 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
85 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
86 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
90 bind_password: z-%@fWipLliR8lD#fl.0teC#9QbhJ^eb
98 bind_password: z-%@fWipLliR8lD#fl.0teC#9QbhJ^eb
102 bind_password: z-%@fWipLliR8lD#fl.0teC#9QbhJ^eb
107 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
108 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
111 transfer_secret: 2%11!zAu*AYE&=d*8dfoZs8jK&5ZMm*%
112 webdav_allow_insecure: true
113 cs3_allow_insecure: true
118 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
119 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
125 - df39a290-3f3e-4e39-b67b-8b810ca2abac
132 mount_id: ef72cb8b-809c-4592-bfd2-1df603295205
134 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
135 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
141 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
142 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
145 tls_skip_verify_client_cert: true
148 storage_users_mount_id: ef72cb8b-809c-4592-bfd2-1df603295205
151 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
152 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
155 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
156 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE
159 service_account_id: df39a290-3f3e-4e39-b67b-8b810ca2abac
160 service_account_secret: .demKypQ$=pGl+yRar!#YaFjLYCr4YwE'';
166 meta.maintainers = with lib.maintainers; [
174 virtualisation.memorySize = 2048;
175 environment.systemPackages = [
176 pkgs.firefox-unwrapped
181 # if you do this in production, dont put secrets in this file because it will be written to the world readable nix store
182 environment.etc."ocis/ocis.env".text = ''
183 ADMIN_PASSWORD=${adminPassword}
184 IDM_CREATE_DEMO_USERS=true
187 # if you do this in production, dont put secrets in this file because it will be written to the world readable nix store
188 environment.etc."ocis/config/ocis.yaml".text = testConfig;
192 configDir = "/etc/ocis/config";
194 OCIS_INSECURE = "true";
196 environmentFile = "/etc/ocis/ocis.env";
202 machine.wait_for_unit("ocis.service")
203 machine.wait_for_open_port(9200)
204 # wait for ocis to fully come up
207 with subtest("ocis bin works"):
208 machine.succeed("${lib.getExe pkgs.ocis-bin} version")
210 with subtest("use the web interface to log in with a demo user"):
211 machine.succeed("PYTHONUNBUFFERED=1 systemd-cat -t test-runner test-runner ${demoUser} ${demoPassword}")
213 with subtest("use the web interface to log in with the provisioned admin user"):
214 machine.succeed("PYTHONUNBUFFERED=1 systemd-cat -t test-runner test-runner ${adminUser} ${adminPassword}")