chore: harmonize and clean up list views (#25961)

This commit is contained in:
Ville Brofeldt
2023-12-04 11:51:18 -08:00
committed by GitHub
parent 3ab27c6ec9
commit 0b477e3f7c
47 changed files with 785 additions and 667 deletions

View File

@@ -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
@@ -189,20 +191,27 @@ class TestCssTemplateApi(SupersetTestCase):
"""
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,