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

        nc.truncateServices("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        response = nc.addService("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data)
        self.assertEqual(response.error, consts.NO_ERROR)

        response = nc.getAllServices("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        self.assertEqual(response.error, consts.NO_ERROR)
        self.assertEqual(len(response.payload), 1)
        response.payload[0].pop(
            "received")  # no way to know what this ought to be
        self.assertEqual(
            response.payload[0], {
                "id": "a",
                "code": "b",
                "provider": "c",
                "member": "d",
                "comment": "e",
                "status": "f",
                "date": "g"
            })
Esempio n. 2
0
    def test_truncateServices_good(self):
        nc = NetworkController()
        key = "AS62ELRB5F0709LERPHZD06JWC0P8QSC"

        response = nc.truncateServices(key)
        self.assertEqual(response.error, consts.NO_ERROR)

        response = nc.getAllServices(key)
        self.assertEqual(response.error, consts.NO_ERROR)
        self.assertEqual(len(response.payload), 0)