Пример #1
0
 def test_all(self):
     """ retrieve all created permissions """
     r1 = Role.create("r1")
     r2 = Role.create("r2")
     r3 = Role.create("r2") # duplicate!
     assert set(Role.all()) == set((r1, r2))
Пример #2
0
 def test_uniqueness_differ(self):
     """ 
         Role with different identifier are not equal
     """
     assert Role.create("foo") != Role("bar")
Пример #3
0
 def test_equality(self):
     """ ordinary comparison. Will succeed since it will be the same
         objects """
     assert Role.create("foo") == Role.create("foo")
Пример #4
0
 def test_uniqueness_attrs(self):
     """ Different instances with same identifier are identical, even
         if other attributes differ """
     assert Role.create("foo", "bar", "bla") is \
            Role.create("foo", "this", "that")
Пример #5
0
 def test_uniqueness_id(self):
     """ Different instances with same identifier are identical """
     assert Role.create("foo") is Role.create("foo")
Пример #6
0
 def test_create(self):
     """ Role are implicitly created """
     assert Role.create("foo") is not None
Пример #7
0
 def test_unicode(self):
     assert isinstance(Role.create("foo").__unicode__(), unicode)
Пример #8
0
def Role(id, name="", description=""):
    return droleRole.create(id, name, description)