def setUpClass(cls): super(TestHcfQuotas, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Loginto Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password})
def setUpClass(cls): super(TestHcfHsmServiceInstance, cls).setUpClass() # Target to the HSM service endpoint hcf_auth.hsm_api(cls.hsm_api) # Log into Hsm Service hcf_auth.login(optional_args={ '-u': cls.hsm_username, '-p': cls.hsm_password })
def test_hcf_invalid_user_login(self): invalid_user = '******' + str(random.randint(1024, 4096)) invalid_pwd = 'invalid_pwd' + str(random.randint(1024, 4096)) # Login to Cluster using invalid Username out, err = hcf_auth.login(input_data=b'\n', optional_args={'-u': invalid_user, '-p': self.password}) self.verify("Unable to authenticate", out) # Login to Cluster using invalid Password out, err = hcf_auth.login(input_data=b'\n', optional_args={'-u': self.username, '-p': invalid_pwd}) self.verify("Unable to authenticate", out) hcf_auth.logout(self.cluster_url)
def setUpClass(cls): super(TestHcfSecurityGroups, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Loginto Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create Organisation cls.org_name = 'org_test' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.org_name) # Create Space out, err = hcf_auth.target(optional_args={'-o': cls.org_name}) cls.space_name = 'space_test' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.space_name)
def setUpClass(cls): super(TestHcfMarketplace, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Log into Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create organisation cls.setup_org = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.setup_org) out, err = hcf_auth.target(optional_args={'-o': cls.setup_org}) # Create Space cls.setup_space = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.setup_space) out, err = hcf_auth.target(optional_args={'-o': cls.setup_org, '-s': cls.setup_space})
def setUpClass(cls): super(TestHcfApps, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Loginto Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create Organisation cls.org_name = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.org_name) # Create Space out, err = hcf_auth.target(optional_args={'-o': cls.org_name}) cls.space_name = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.space_name) parsed = urlparse(cls.app_url) link = parsed.path.split('/') cls.app_dir = link[len(link) - 1]
def test_hcf_user_operations(self): # Login with admin to create user hcf_auth.login(optional_args={'-u': self.username, '-p': self.password}) # Create an organisation to bind with user org_name = 'og_test_org' + str(random.randint(1024, 4096)) hcf_organisations.create_org(org_name) # Create a space to bind with user out, err = hcf_auth.target(optional_args={'-o': org_name}) space_name = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(space_name) out, err = hcf_auth.target(optional_args={'-s': space_name}) # Create user user_name = 'hcf_test_user' + str(random.randint(1024, 4096)) password = '******' + str(random.randint(1024, 4096)) out, err = hcf_users.create_user(user_name, password) self.verify(user_name, out) self.verify("OK", out) # Set role for user in an organisation org_role = "OrgManager" out, err = hcf_users.set_org_role(user_name, org_name, org_role) self.verify("OK", out) self.verify(org_name, out) self.verify(org_role, out) # Unset role for user in an organisation out, err = hcf_users.unset_org_role(user_name, org_name, org_role) self.verify("OK", out) self.verify(org_name, out) # Set role for user in a space space_role = "SpaceDeveloper" out, err = hcf_users.set_space_role( user_name, org_name, space_name, space_role) self.verify("OK", out) self.verify(space_name, out) self.verify(space_role, out) # Unset role for user in a space out, err = hcf_users.unset_space_role( user_name, org_name, space_name, space_role) self.verify("OK", out) self.verify(space_name, out) hcf_auth.logout(self.cluster_url) # Login with the created user out, err = hcf_auth.login(optional_args={'-u': user_name, '-p': password}) self.verify("Authenticating", out) self.verify("OK", out) hcf_auth.logout(self.cluster_url) # Login with admin to delete user hcf_auth.login(optional_args={'-u': self.username, '-p': self.password}) # Delete User out, err = hcf_users.delete_user( user_name, input_data=b'yes\n') self.verify("OK", out) # Delete org hcf_organisations.delete_org(org_name, input_data=b'yes\n') hcf_auth.logout(self.cluster_url)