(hq_env: HqEnv)
| 229 | |
| 230 | |
| 231 | def test_generate_partial_access_hosts(hq_env: HqEnv): |
| 232 | client_port = 18000 + random.randint(0, 1000) |
| 233 | worker_port = 14000 + random.randint(0, 1000) |
| 234 | hq_env.command( |
| 235 | [ |
| 236 | "server", |
| 237 | "generate-access", |
| 238 | "myaccess.json", |
| 239 | f"--worker-port={worker_port}", |
| 240 | f"--client-port={client_port}", |
| 241 | "--client-file=client.json", |
| 242 | "--worker-file=worker.json", |
| 243 | "--worker-host=192.168.1.1", |
| 244 | "--client-host=baf.bar.cz", |
| 245 | ], |
| 246 | use_server_dir=False, |
| 247 | ) |
| 248 | |
| 249 | with open("client.json", "r") as f: |
| 250 | access = json.load(f) |
| 251 | |
| 252 | schema = Schema( |
| 253 | { |
| 254 | "version": str, |
| 255 | "client": {"host": "baf.bar.cz", "port": client_port, "secret_key": str}, |
| 256 | }, |
| 257 | ) |
| 258 | schema.validate(access) |
| 259 | |
| 260 | with open("worker.json", "r") as f: |
| 261 | access = json.load(f) |
| 262 | |
| 263 | schema = Schema( |
| 264 | { |
| 265 | "version": str, |
| 266 | "worker": {"host": "192.168.1.1", "port": worker_port, "secret_key": str}, |
| 267 | }, |
| 268 | ) |
| 269 | schema.validate(access) |
| 270 | |
| 271 | hq_env.start_server(args=["--access-file=myaccess.json"]) |
| 272 | |
| 273 | |
| 274 | def test_server_debug_dump(hq_env: HqEnv): |
nothing calls this directly
no test coverage detected