Exemplo n.º 1
0
def test_encryption():
    pb = PushBullet("apikey", "hunter42")

    original = {"cat": "meow!"}
    encrypted = pb._encrypt_data(original)
    decrpyted = pb._decrypt_data(encrypted)

    assert original == json.loads(decrpyted)
Exemplo n.º 2
0
def test_encryption_invalid_version():
    pb = PushBullet("apikey", "hunter42")

    original = {"cat": "meow!"}
    encrypted = pb._encrypt_data(original)
    encrypted = "2" + encrypted[1:]

    with pytest.raises(Exception):
        pb._decrypt_data(encrypted)