Beispiel #1
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)
Beispiel #2
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"))
Beispiel #3
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"))
Beispiel #4
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)
Beispiel #5
0
    def test_get_fail(self):
        # Arrange
        mp = Map("Test map", "")
        store = MapStore()
        errorText = 'Map does not exist in store'

        # Act
        try:
            store.get(mp)
            
        # Assert
        except Exception as ex:
            self.assertEqual(str(ex), errorText)
Beispiel #6
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"])
Beispiel #7
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)
Beispiel #8
0
    def __init__(self, conn):
        # Initialise the stores
        self.drones = DroneStore(conn)
        self.operators = OperatorStore(conn)
        self.tracking = TrackingSystem()
        self.maps = MapStore(conn)

        # Initialise the GUI window
        self.root = tk.Tk()
        self.root.title('Drone Allocation and Localisation')
        frame = tk.Frame(self.root)
        frame.pack(padx=10, pady=10)

        # Add in the buttons
        drone_button = tk.Button(
            frame, text="View Drones", command=self.view_drones, width=40, padx=5, pady=5)
        drone_button.pack(side=tk.TOP)
        operator_button = tk.Button(
            frame, text="View Operators", command=self.view_operators, width=40, padx=5, pady=5)
        operator_button.pack(side=tk.TOP)
        map_button = tk.Button(
            frame, text="View Map", command=self.view_map, width=40, padx=5, pady=5)
        map_button.pack(side=tk.TOP)
        exit_button = tk.Button(frame, text="Exit System",
                                command=quit, width=40, padx=5, pady=5)
        exit_button.pack(side=tk.TOP)
Beispiel #9
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)
Beispiel #10
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(), [])
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
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)