wrolpi/modules/otp/test/test_api.py
Roland a1e0fb4e92 Creating a new Collection model for use in organizing FileGroups.
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.
2025-12-06 15:11:37 -07:00

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