Example #1
0
    def test_removeProvider_unauthorized(self):
        nc = NetworkController()

        nc.truncateProviders("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addProvider(
            "AS62ELRB5F0709LERPHZD06JWC0P8QSC", {
                "id": "a",
                "name": "b",
                "address": "c",
                "city": "d",
                "state": "e",
                "zip": "f"
            })
        response = nc.removeProvider("DDPR0TG8EF760QR2J7IUF3UFIRXXL4E3", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)

        response = nc.removeProvider("asd", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)
Example #2
0
    def test_removeProvider_good(self):
        nc = NetworkController()

        nc.truncateProviders("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addProvider(
            "AS62ELRB5F0709LERPHZD06JWC0P8QSC", {
                "id": "a",
                "name": "b",
                "address": "c",
                "city": "d",
                "state": "e",
                "zip": "f"
            })
        response = nc.removeProvider("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")
        self.assertEqual(response.error, consts.NO_ERROR)

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