mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
Replacing Channels and Domains with Collection. Moving downloading relationships from Channel to Collection. Created domains.yaml config to manage tagged domain collections. Adding turn-key upgrade solution in the UI.
34 lines
965 B
Python
34 lines
965 B
Python
import json
|
|
from http import HTTPStatus
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_encrypt(async_client):
|
|
body = dict(otp='asdf', plaintext='asdf')
|
|
request, response = await async_client.post('/api/otp/encrypt_otp', content=json.dumps(body))
|
|
assert response.status_code == HTTPStatus.OK
|
|
assert response.json == dict(
|
|
ciphertext='AAGK',
|
|
otp='ASDF',
|
|
plaintext='ASDF',
|
|
)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_decrypt(async_client):
|
|
body = dict(otp='asdf', ciphertext='aagk')
|
|
request, response = await async_client.post('/api/otp/decrypt_otp', content=json.dumps(body))
|
|
assert response.status_code == HTTPStatus.OK
|
|
assert response.json == dict(
|
|
ciphertext='AAGK',
|
|
otp='ASDF',
|
|
plaintext='ASDF',
|
|
)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_html(async_client):
|
|
request, response = await async_client.get('/api/otp/html')
|
|
assert response.status_code == HTTPStatus.OK
|