def test_getGuestByUUID(self): # attempt to retrieve guest by UUID user_uuid = pL.insertUser("*****@*****.**") guest_uuid = pL.insertGuestwithUUID(user_uuid, "Claire", "B.", "Test", "*****@*****.**", "555-7745", "10 Test Lane", "Testville", "Tenesssee", "00235") self.assertTrue(pL.getGuestbyUUID(guest_uuid) != None)
def test_deleteGuest(self): # attempt to deleta a new Guest user_uuid = pL.insertUser("*****@*****.**") guest_uuid = pL.insertGuestwithUUID(user_uuid, "Terry", "A.", "Test", "*****@*****.**", "555-4567", "13 Test Lane", "Testville", "Tenesssee", "00234") pL.deleteGuest(guest_uuid) self.assertTrue(pL.getGuestbyUUID(guest_uuid) == None)
def test_insertGuestwithUUID( self): # attempt to insert new Guest with a user user_uuid = pL.insertUser("*****@*****.**") guest_uuid = pL.insertGuestwithUUID(user_uuid, "James", "F.", "Test", "*****@*****.**", "555-3456", "12 Test Lane", "Testville", "Tenesssee", "00234") self.assertTrue(guest_uuid != None)
def test_getGuestByName( self): # attempt to retrieve guest by first and last name user_uuid = pL.insertUser("*****@*****.**") guest_uuid = pL.insertGuestwithUUID(user_uuid, "Joseph", "E.", "Test", "*****@*****.**", "555-9774", "40 Test Lane", "Testville", "Tenesssee", "00235") self.assertTrue(pL.getGuestbyName("Joseph", "Test") != None)
def test_updateGuestEmail(self): # attempt to change the email of a guest user_uuid = pL.insertUser("*****@*****.**") guest_uuid = pL.insertGuestwithUUID(user_uuid, "Monica", "A.", "Test", "*****@*****.**", "555-2345", "11 Test Lane", "Testville", "Tenesssee", "00234") pL.updateGuestEmail("*****@*****.**", guest_uuid) self.assertTrue( pL.getGuestbyUUID(guest_uuid)['email'] == "*****@*****.**")
def test_getGuests( self ): # Add two guests, attempt to retrieve all guests, make sure both are present userA_uuid = pL.insertUser("*****@*****.**") userB_uuid = pL.insertUser("*****@*****.**") guestA_uuid = pL.insertGuestwithUUID(userA_uuid, "Bruce", "Z.", "Test", "*****@*****.**", "555-7746", "9 Test Lane", "Testville", "Tenesssee", "00235") guestB_uuid = pL.insertGuestwithUUID(userB_uuid, "Mary", "X.", "Test", "*****@*****.**", "555-7746", "9 Test Lane", "Testville", "Tenesssee", "00235") presence = 0 guests = pL.getGuests() for guest in guests: if guest['uuid'] == guestA_uuid or guest['uuid'] == guestB_uuid: presence = presence + 1 self.assertTrue(presence == 2)