def test_getKey_unauthorized(self): nc = NetworkController() data = {"id": "a", "level": "b", "name": "c"} nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data) response = nc.getKey("asdf", "a") self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)
def test_getKey_nonexistent(self): nc = NetworkController() data = {"id": "a", "level": "b", "name": "c"} nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data) response = nc.getKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "b") self.assertEqual(response.error, consts.ERROR_NONEXISTENT_ENTRY)
def test_getKey_goodByUnhashedUak(self): nc = NetworkController() data = {"id": "a", "level": "b", "name": "c"} nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC") nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data) response = nc.getKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a") self.assertEqual(response.error, consts.NO_ERROR) self.assertEqual(response.payload["level"], "b") self.assertEqual(response.payload["name"], "c")