Ejemplo n.º 1
0
    def tearDownClass(cls):
        # Delete org
        out, err = hcf_organisations.delete_org(cls.org_name,
                                                input_data=b'yes\n')

        super(TestHcfSecurityGroups, cls).tearDownClass()
        hcf_auth.logout(cls.cluster_url)
    def tearDownClass(cls):
        super(TestHcfDockerApps, cls).tearDownClass()

        # Delete org
        out, err = hcf_organisations.delete_org(cls.org_name,
                                                input_data=b'yes\n')

        # Logout from Cluster
        hcf_auth.logout(cls.cluster_url)
Ejemplo n.º 3
0
    def tearDownClass(cls):
        super(TestHcfApps, cls).tearDownClass()

        # Delete org
        out, err = hcf_organisations.delete_org(cls.org_name,
                                                input_data=b'yes\n')

        # Logout from Cluster
        hcf_auth.logout(cls.cluster_url)
        if os.path.isdir(cls.app_dir):
            common.executeShellCommand('rm -rf ' + str(cls.app_dir))
    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 tearDownClass(cls):
     super(TestHcfServices, cls).tearDownClass()
     hcf_space.delete_space(cls.setup_space, input_data=b'yes\n')
     hcf_organisations.delete_org(cls.setup_org, input_data=b'yes\n')
     hcf_auth.logout(cls.cluster_url)
    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)
 def tearDownClass(cls):
     super(TestHcfUsers, cls).tearDownClass()
     hcf_auth.logout(cls.cluster_url)
Ejemplo n.º 8
0
 def tearDownClass(cls):
     super(TestHcfOrgSpaceDomain, cls).tearDownClass()
     hcf_organisations.delete_org(cls.setup_org, input_data=b'yes\n')
     hcf_auth.logout(cls.cluster_url)