예제 #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)
예제 #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"))
예제 #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"))
예제 #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)
예제 #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)
예제 #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"])
예제 #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)
예제 #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)
예제 #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)
예제 #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(), [])
예제 #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)
예제 #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)
예제 #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)