Beispiel #1
0
 def test_retrieve_one_raiseError(self):
     "An exeption is raised when multiple objects are found."
     gotError = False
     try:
         u = ormmanager.retrieve_one(User, display_name='Bob Villa')
     except LookupError:
         gotError = True
     assert gotError
Beispiel #2
0
 def test_retrieve_one_returnNone(self):
     "retrieve_one returns None when no matches are found"
     u = ormmanager.retrieve_one(User, user_name='bobdog')
     assert u is None
Beispiel #3
0
 def test_retrieve_one_singleKW(self):
     "retrieve_one works with a single keyword."
     u = ormmanager.retrieve_one(User, user_name='bobvilla')
     assert isinstance(u, User)
     assert u.password == 'toughasnails'
Beispiel #4
0
 def test_retrieve_one_multipleKW(self):
     "retrieve_one works with multiple keywords"
     u = ormmanager.retrieve_one(User, user_name='bobvilla', 
                        email_address='*****@*****.**')
     assert isinstance(u, User)
     assert u.password == 'toughasnails'
Beispiel #5
0
 def test_delete(self):
     "delete an object from the database"
     u = ormmanager.retrieve_one(User, user_name='bobvilla')
     ormmanager.delete(u)
     assert ormmanager.retrieve_one(User, user_name='bobvilla') is None