def test_get_deleted(self): record = zdb.get_ipv4_record(0x01020304, 443, 80, 5) hq = zdb.host_query_from_record(record) delta = self.service.PutHostIPv4Record(record, self.TIMEOUT) delta = self.service.DelHostIPv4Record(hq, self.TIMEOUT) res = self.service.GetHostIPv4Record(hq, self.TIMEOUT) self.assertEqual(HostQueryResponse.NO_RECORD, res.status)
def test_get_exists(self): record = zdb.get_ipv4_record(0x01020304, 443, 80, 5) delta = self.service.PutHostIPv4Record(record, self.TIMEOUT) self.assertIsNotNone(delta) hq = zdb.host_query_from_record(record) res = self.service.GetHostIPv4Record(hq, self.TIMEOUT) self.assertEqual(HostQueryResponse.SUCCESS, res.status) self.assertHostQueryResponseMatchesHostQuery(res, hq) self.assertRecordEqual(record, res.record)
def test_insert_delete_one_ipv4(self): record = zdb.get_ipv4_record(0x01020304, 443, 80, 5) delta = self.service.PutHostIPv4Record(record, self.TIMEOUT) self.assertIsNotNone(delta) hq = zdb.host_query_from_record(record) delta = self.service.DelHostIPv4Record(hq, self.TIMEOUT) self.assertIsNotNone(delta) self.assertEqual(delta.delta_type, common_pb2.DT_DELETE) self.assertDeltaMatchesHostQuery(delta, hq) self.assertDeltaMatchesRecords(delta, [])