Skip to content

Commit

Permalink
feat(tests): add test for html banner message
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekys authored and utnapischtim committed Nov 3, 2024
1 parent e9cd3c1 commit cb87dc2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/resources/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
"%Y-%m-%d %H:%M:%S"
),
},
"html_banner": {
"message": '<h1>HTML aware banner.</h1>.\n \'<p class="test">paragraph<br /></p><script '
"type=\"text/javascript\">alert('You won!')</script>",
"url_path": "/html_banner",
"category": "warning",
"active": True,
"start_datetime": datetime(2022, 7, 20, 20, 0, 0).strftime("%Y-%m-%d %H:%M:%S"),
},
}


Expand Down Expand Up @@ -376,3 +384,14 @@ def test_search_banner_empty_list(client, user):
result = banners["hits"]
assert len(result["hits"]) == 0
assert result["total"] == 0


def test_html_banner(client, admin, headers):
banner_data = banners["html_banner"]
admin.login(client)

banner = _create_banner(client, banner_data, headers, 201).json
assert (
banner["message"]
== "<h1>HTML aware banner.</h1>.\n '<p>paragraph<br></p>alert('You won!')"
)

0 comments on commit cb87dc2

Please sign in to comment.