Exemplo n.º 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))
Exemplo n.º 2
0
 def test_uniqueness_differ(self):
     """ 
         Role with different identifier are not equal
     """
     assert Role.create("foo") != Role("bar")
Exemplo n.º 3
0
 def test_equality(self):
     """ ordinary comparison. Will succeed since it will be the same
         objects """
     assert Role.create("foo") == Role.create("foo")
Exemplo n.º 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")
Exemplo n.º 5
0
 def test_uniqueness_id(self):
     """ Different instances with same identifier are identical """
     assert Role.create("foo") is Role.create("foo")
Exemplo n.º 6
0
 def test_create(self):
     """ Role are implicitly created """
     assert Role.create("foo") is not None
Exemplo n.º 7
0
 def test_unicode(self):
     assert isinstance(Role.create("foo").__unicode__(), unicode)
Exemplo n.º 8
0
def Role(id, name="", description=""):
    return droleRole.create(id, name, description)