Exemple #1
0
    def test_removeKey_unauthorized(self):
        nc = NetworkController()

        nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", {
            "uak": "a",
            "level": "b",
            "name": "c"
        })
        response = nc.removeKey("DDPR0TG8EF760QR2J7IUF3UFIRXXL4E3", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)

        response = nc.removeKey("asd", "a")
        self.assertEqual(response.error, consts.ERROR_UNAUTHORIZED_OPERATION)
Exemple #2
0
    def test_removeKey_goodByUak(self):
        nc = NetworkController()

        nc.truncateKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        nc.addKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", {
            "id": "a",
            "level": "b",
            "name": "c"
        })

        response = nc.removeKey("AS62ELRB5F0709LERPHZD06JWC0P8QSC", "a")

        self.assertEqual(response.error, consts.NO_ERROR)
        response = nc.getAllKeys("AS62ELRB5F0709LERPHZD06JWC0P8QSC")
        self.assertEqual(len(response.payload), 0)