Ejemplo n.º 1
0
    def test_setService_good(self):
        nc = NetworkController()
        data = {
            "id": "a",
            "code": "b",
            "provider": "c",
            "member": "d",
            "comment": "e",
            "status": "f",
            "date": "g"
        }

        nc.truncateServices("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        nc.setService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a", {"name": "c"})
        response = nc.getService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")
        self.assertEqual(response.error, consts.NO_ERROR)
        response.payload.pop("received")  # no way to know what this should be
        self.assertEqual(
            response.payload, {
                "id": "a",
                "code": "b",
                "provider": "c",
                "member": "d",
                "comment": "e",
                "status": "f",
                "date": "g"
            })
Ejemplo n.º 2
0
    def test_getService_nonexistent(self):
        nc = NetworkController()
        data = {
            "id": "a",
            "code": "b",
            "provider": "c",
            "member": "d",
            "comment": "e",
            "status": "f",
            "date": "g"
        }

        nc.truncateServices("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        response = nc.getService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "b")
        self.assertEqual(response.error, consts.ERROR_NONEXISTENT_ENTRY)
Ejemplo n.º 3
0
    def test_getService_unauthorized(self):
        nc = NetworkController()
        data = {
            "id": "a",
            "code": "b",
            "provider": "c",
            "member": "d",
            "comment": "e",
            "status": "f",
            "date": "g"
        }

        nc.truncateServices("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        response = nc.getService("asdf", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)