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