Skip to content

Commit

Permalink
fix css test
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Nov 26, 2023
1 parent 59da29e commit 4d21068
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/integration_tests/css_templates/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import json
import pytest
import prison
from datetime import datetime
from freezegun import freeze_time
from sqlalchemy.sql import func

import tests.integration_tests.test_app
Expand Down Expand Up @@ -189,20 +191,27 @@ def test_get_css_template(self):
"""
CSS Template API: Test get CSS Template
"""
css_template = (
db.session.query(CssTemplate)
.filter(CssTemplate.template_name == "template_name1")
.one_or_none()
)
self.login(username="admin")
uri = f"api/v1/css_template/{css_template.id}"
rv = self.get_assert_metric(uri, "get")
with freeze_time(datetime.now()):
css_template = (
db.session.query(CssTemplate)
.filter(CssTemplate.template_name == "template_name1")
.one_or_none()
)
self.login(username="admin")
uri = f"api/v1/css_template/{css_template.id}"
rv = self.get_assert_metric(uri, "get")
assert rv.status_code == 200

expected_result = {
"id": css_template.id,
"template_name": "template_name1",
"css": "css1",
"changed_by": {
"first_name": css_template.created_by.first_name,
"id": css_template.created_by.id,
"last_name": css_template.created_by.last_name,
},
"changed_on_delta_humanized": "now",
"created_by": {
"first_name": css_template.created_by.first_name,
"id": css_template.created_by.id,
Expand Down

0 comments on commit 4d21068

Please sign in to comment.