예제 #1
0
    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(), [])
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)