29 lines
857 B
Python
29 lines
857 B
Python
import os
|
|
|
|
|
|
def test_vhost_mgr(cloud_srv):
|
|
vhost_mgr = cloud_srv.vhost_mgr
|
|
username = 'test1'
|
|
domain = username + '.csclub.cloud'
|
|
filename = f'{username}_{domain}'
|
|
ip_address = '172.19.134.11'
|
|
vhost_mgr.create_vhost(username, domain, ip_address)
|
|
path = os.path.join(vhost_mgr.vhost_dir, filename)
|
|
assert os.path.isfile(path)
|
|
|
|
assert vhost_mgr.get_num_vhosts(username) == 1
|
|
|
|
assert vhost_mgr.get_vhosts(username) == [{
|
|
'domain': domain, 'ip_address': ip_address,
|
|
}]
|
|
|
|
domain2 = 'app.' + domain
|
|
vhost_mgr.create_vhost(username, domain2, ip_address)
|
|
assert vhost_mgr.get_num_vhosts(username) == 2
|
|
|
|
vhost_mgr.delete_vhost(username, domain)
|
|
assert vhost_mgr.get_num_vhosts(username) == 1
|
|
|
|
vhost_mgr.delete_all_vhosts_for_user(username)
|
|
assert vhost_mgr.get_num_vhosts(username) == 0
|