def test_remove_success(self): # Arrange mp = Map("Test map", "") store = MapStore() store.add(mp) # Act store.remove(mp) # Assert self.assertEqual(store.list_all(), [])
def test_remove_fail(self): # Arrange mp = Map("Test map", "") store = MapStore() errorText = 'Map does not exist in store' # Act try: store.remove(mp) # Assert except Exception as ex: self.assertEqual(str(ex), errorText)
def test_remove_map_exception(self): #Arrange m = Map("mappy", "somefilepath") n = Map("flappy", "anotherfilepath") mStore = MapStore() mStore.add(m) mStore.add(n) mStore.remove(m) #Act and Assert with self.assertRaises(Exception): mStore.remove(m)
def test_remove_map(self): #Arrange m = Map("mappy", "somefilepath") n = Map("flappy", "anotherfilepath") mStore = MapStore() mStore.add(m) mStore.add(n) #Act mStore.remove(m) #Assert listy = [] for i in mStore.list_all(): listy.append(mStore.get(i)) self.assertNotIn(m, listy)