utils¶
Functions
- login(user: Literal['admin', 'teacher', 'student']) Callable[[Callable[P, T]], Callable[P, T]] [source]¶
Login
client
as a tin user type.@login("admin") def test_no_redirect(client, course): response = client.post(reverse("courses:index"), {}) assert not_login_redirect(response) @login("teacher") def test_teacher_thing(client): # client is logged in as a teacher @login("student") def test_redirect(client): # client is a student def test_something(client): response = client.post(reverse("courses:index"), {}) assert is_login_redirect(response)
- str_to_html(s: str) str [source]¶
Converts a string to it’s html representation
>>> text = "It's annoying to remember HTML escape codes" >>> str_to_html(text) 'It's annoying to remember HTML escape codes'