Beispiel #1
0
    def setUp(self):
        super(SimpleUserGroupTests, self).setUp()
        if RestAuthUser.get_all(self.conn):
            raise RuntimeError("Found leftover users.")
        if RestAuthGroup.get_all(self.conn):
            raise RuntimeError("Found leftover groups.")

        self.user = RestAuthUser.create(self.conn, username, password)
        self.group = RestAuthGroup.create(self.conn, groupname)
Beispiel #2
0
    def test_removeGroupClass(self):
        self.assertFalse(self.user.in_group(self.group))
        self.assertEqual([], self.user.get_groups())

        self.user.add_group(self.group)
        self.assertTrue(self.user.in_group(self.group))
        self.assertEqual([self.group], RestAuthGroup.get_all(self.conn, self.user))

        self.user.remove_group(self.group)
        self.assertFalse(self.user.in_group(self.group))
        self.assertEqual([], self.user.get_groups())
Beispiel #3
0
 def test_addGroupClass(self):
     self.user.add_group(self.group)
     self.assertEqual([self.group], self.user.get_groups())
     self.assertEqual([self.group], RestAuthGroup.get_all(self.conn, self.user))
Beispiel #4
0
 def tearDown(self):
     for user in RestAuthUser.get_all(self.conn):
         user.remove()
     for grp in RestAuthGroup.get_all(self.conn):
         grp.remove()