Files
Anthias/tests/test_utils.py
Viktor Petersson d89ee67b1e feat: simplify architecture from 6 containers to 2
- Delete legacy API versions (v1, v1.1, v1.2), keep only v2
- Replace Celery + Redis with threading-based background tasks
- Replace React/TypeScript/webpack frontend with Django templates + HTMX + Bootstrap 5
- Replace ZMQ pub/sub with Django Channels WebSocket
- Replace Nginx with WhiteNoise for static file serving
- Replace Gunicorn with Daphne (ASGI) for WebSocket support
- Simplify Docker from 6 services to 2 (server + viewer)
- Migrate test suite from unittest to pytest
- Remove ~20,000 lines of code and dozens of dependencies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 05:35:08 +00:00

33 lines
886 B
Python

# coding=utf-8
from datetime import datetime
import pytest
from lib.utils import handler, template_handle_unicode, url_fails
class TestUtils:
def test_unicode_correctness_in_bottle_templates(self):
assert template_handle_unicode('hello') == 'hello'
assert (
template_handle_unicode('Привет')
== '\u041f\u0440\u0438\u0432\u0435\u0442'
)
def test_json_tz(self):
json_str = handler(datetime(2016, 7, 19, 12, 42))
assert json_str == '2016-07-19T12:42:00+00:00'
@pytest.mark.django_db
class TestURLHelper:
def test_url_fails_for_bad_domain(self):
assert url_fails('http://doesnotwork.example.com')
def test_url_succeeds_for_redirect(self):
assert not url_fails('http://example.com')
def test_url_succeeds_for_local_path(self):
assert not url_fails('/home/user/file')