Exemplo n.º 1
0
    def test_superuser(self):
        owners = owner_qs(self.cluster, self.superuser)
        valid_owners = [self.admin_group.organization,
                        self.non_admin_group.organization,
                        self.standard.get_profile(),
                        self.superuser.get_profile()]

        self.assertQuerysetEqual(owners, map(repr, valid_owners))
Exemplo n.º 2
0
 def test_create_vm_perms_group(self):
     self.non_admin_group.grant('create_vm', self.cluster)
     owners = owner_qs(self.cluster, self.standard)
     valid_owners = [self.admin_group.organization,
                     self.non_admin_group.organization]
     self.assertQuerysetEqual(owners, map(repr, valid_owners))
Exemplo n.º 3
0
 def test_user_in_non_admin_group(self):
     self.standard.groups.remove(self.admin_group)
     owners = owner_qs(self.cluster, self.standard)
     self.assertQuerysetEqual(owners, [])
Exemplo n.º 4
0
 def test_user_in_admin_group(self):
     owners = owner_qs(self.cluster, self.standard)
     valid_owners = [repr(self.admin_group.organization)]
     self.assertQuerysetEqual(owners, valid_owners)
Exemplo n.º 5
0
 def test_create_vm_perms(self):
     self.noperms.grant('create_vm', self.cluster)
     owners = owner_qs(self.cluster, self.noperms)
     valid_owners = [repr(self.noperms.get_profile())]
     self.assertQuerysetEqual(owners, valid_owners)
Exemplo n.º 6
0
 def test_noperms_user(self):
     owners = owner_qs(self.cluster, self.noperms)
     self.assertQuerysetEqual(owners, [])
Exemplo n.º 7
0
 def test_admin_user(self):
     owners = owner_qs(self.cluster, self.admin)
     valid_owners = [self.admin.get_profile()]
     self.assertQuerysetEqual(owners, map(repr, valid_owners))
Exemplo n.º 8
0
 def test_superuser(self):
     owners = owner_qs(self.cluster, self.superuser)
     valid_owners_list = [self.admin, self.noperms, self.superuser]
     valid_owners = map(lambda user: user.get_profile(), valid_owners_list)
     self.assertQuerysetEqual(owners, map(repr, valid_owners))
Exemplo n.º 9
0
 def test_no_cluster(self):
     owners = owner_qs(None, self.admin)
     self.assertQuerysetEqual(owners, [])