docstr: CSS Template API: Test get list and sort CSS Template
docstr_tok: ["CSS","Template","API",":","Test","get","list","and","sort","CSS","Template"]
code: def test_get_list_sort_css_template(self):
      """
      CSS Template API: Test get list and sort CSS Template
      """
      css_templates = (
          db.session.query(CssTemplate)
          .order_by(CssTemplate.template_name.asc())
          .all()
      )
      self.login(username="admin")
      query_string = {
          "order_column": "template_name",
          "order_direction": "asc",
      }
      uri = f"api/v1/css_template/?q={prison.dumps(query_string)}"
      rv = self.get_assert_metric(uri, "get_list")
      assert rv.status_code == 200
      data = json.loads(rv.data.decode("utf-8"))
      assert data["count"] == len(css_templates)
      for i, query in enumerate(css_templates):
          assert (
              query.template_name == data["result"][i]["template_name"]
          )
  
imports: 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
  from superset import db
  from superset.models.core import CssTemplate
  from superset.utils.database import get_example_database
  from tests.integration_tests.base_tests import SupersetTestCase
label_desc: Use image node_id 4 for calling the TestCssTemplateApi obj's underlying member method code with example usage: obj.test_get_list_sort_css_template() without return types