def test_removeKey_goodByHash(self): nc = NetworkController() nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", { "id": "a", "level": "b", "name": "c" }) response = nc.getAllKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") id = response.payload[0]["id"] response = nc.removeKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", id) self.assertEqual(response.error, consts.NO_ERROR) response = nc.getAllKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") self.assertEqual(len(response.payload), 0)
def test_truncateKeys_good(self): nc = NetworkController() key = "AS62ELRB5F0709LERPHZD06JWC0P8QSC" response = nc.truncateKeys(key) self.assertEqual(response.error, consts.NO_ERROR) response = nc.getAllKeys(key) self.assertEqual(response.error, consts.NO_ERROR) self.assertEqual(len(response.payload), 0)
def test_getKey_goodByHashedUak(self): nc = NetworkController() data = {"id": "a", "level": "b", "name": "c"} nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data) response = nc.getAllKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") id = response.payload[0]["id"] response = nc.getKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", id) self.assertEqual(response.error, consts.NO_ERROR) self.assertEqual(response.payload["level"], "b") self.assertEqual(response.payload["name"], "c")