예제 #1
0
    def test_getMenuItem_unauthorized(self):
        nc = NetworkController()
        data = {"id": "a", "name": "b", "fee": "100"}

        nc.truncateMenu("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        response = nc.getMenuItem("asdf", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)
예제 #2
0
    def test_getMenuItem_nonexistent(self):
        nc = NetworkController()
        data = {"id": "a", "name": "b", "fee": "100"}

        nc.truncateMenu("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        response = nc.getMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "b")
        self.assertEqual(response.error, consts.ERROR_NONEXISTENT_ENTRY)
예제 #3
0
    def test_getMenuItem_good(self):
        nc = NetworkController()
        data = {"id": "a", "name": "b", "fee": "100"}

        nc.truncateMenu("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        response = nc.getMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")
        self.assertEqual(response.error, consts.NO_ERROR)
        self.assertEqual(response.payload, {
            "id": "a",
            "name": "b",
            "fee": "100"
        })
예제 #4
0
    def test_removeMenuItem_good(self):
        nc = NetworkController()

        nc.truncateMenu("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", {
            "id": "a",
            "name": "b",
            "fee": "100"
        })
        response = nc.removeMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")
        self.assertEqual(response.error, consts.NO_ERROR)

        response = nc.getMenuItem("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")
        self.assertEqual(response.error, consts.ERROR_NONEXISTENT_ENTRY)