Example #1
0
    def test_add_map_exception(self):
        #Arrange
        m = Map("mappy", "somefilepath")
        mStore = MapStore()

        mStore.add(m)

        #Act and Assert
        with self.assertRaises(Exception):
            mStore.add(m)
Example #2
0
    def test_add_success(self):
        # Arrange
        mp = Map("Test map", "")
        store = MapStore()

        # Act
        store.add(mp)

        # Assert
        self.assertEqual(store.get("Test map"), mp)
Example #3
0
    def test_get_fail(self):
        #Arrange
        m = Map("mappy", "somefilepath")
        n = Map("flappy", "anotherfilepath")
        mStore = MapStore()

        mStore.add(m)
        mStore.add(n)

        #Act and Assert
        self.assertIsNone(mStore.get("tappy"))
Example #4
0
    def test_get(self):
        #Arrange
        m = Map("mappy", "somefilepath")
        n = Map("flappy", "anotherfilepath")
        mStore = MapStore()

        mStore.add(m)
        mStore.add(n)

        #Act and Assert
        self.assertEquals(m, mStore.get("mappy"))
Example #5
0
    def test_get_success(self):
        # Arrange
        mp = Map("Test map", "")
        store = MapStore()
        store.add(mp)
        
        # Act
        act = store.get("Test map")

        # Assert
        self.assertEqual(act, mp)
Example #6
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(), [])
Example #7
0
    def test_list_all(self):
        # Arrange
        mp1 = Map("Test map 1", "")
        mp2 = Map("Test map 2", "")
        store = MapStore()
        store.add(mp1)
        store.add(mp2)

        # Act
        act = store.list_all()

        #Assert
        self.assertEqual(act, ["Test map 1", "Test map 2"])
Example #8
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)
Example #9
0
    def test_add_fail(self):
        # Arrange
        mp = Map("Test map", "")
        store = MapStore()
        errorText = 'Map already exists in store'

        # Act
        try:
            store.add(mp)
            store.add(mp)
            
        # Assert
        except Exception as ex:
            self.assertEqual(str(ex), errorText)
Example #10
0
    def test_add_map(self):
        #Arrange
        m = Map("mappy", "somefilepath")
        mStore = MapStore()

        #Act
        mStore.add(m)

        #Assert
        listy = []

        for i in mStore.list_all():
            listy.append(mStore.get(i))

        self.assertIn(m, listy)
Example #11
0
    def test_list_all(self):
        #Arrange
        m = Map("mappy", "somefilepath")
        n = Map("flappy", "anotherfilepath")
        mStore = MapStore()

        mStore.add(m)
        mStore.add(n)

        #Act and Assert
        listy = []

        for i in mStore.list_all():
            listy.append(mStore.get(i))

        self.assertIn(m, listy)
        self.assertIn(n, listy)