87: add tests for custom vhosts

Signed-off-by: n4chung <n4chung@csclub.uwaterloo.ca>
This commit is contained in:
Nathan Chung 2023-01-06 21:25:59 -05:00
parent 3331e1e3ef
commit 1505b07600
Signed by: n4chung
GPG Key ID: 594AD8B44154B88A
1 changed files with 18 additions and 0 deletions

View File

@ -124,6 +124,24 @@ def test_cloud_vhosts(cfg, client, new_user, ldap_conn):
principal=uid)
assert status == 400
# invalid custom domain name (with TXT record)
custom_domain = "uwaterloo.ca"
ip2 = ip1
status, _ = client.put(
f'/api/cloud/vhosts/{custom_domain}', json={'ip_address': ip2},
principal=uid)
assert status == 400
# invalid custom domain name (without TXT record)
custom_domain2 = "google.com"
ip2 = ip1
status, _ = client.put(
f'/api/cloud/vhosts/{custom_domain2}', json={'ip_address': ip2},
principal=uid)
assert status == 400
# TODO: valid custom domain name
# invalid IP address
domain3 = domain1
ip3 = '129.97.134.10'