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