Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisclark committed Aug 22, 2024
1 parent 479fdff commit 8d2b76a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 1 addition & 3 deletions explorer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from django.utils.translation import gettext_lazy as _

from explorer import app_settings
# import the models so that the migration tooling knows the assistant models are part of the explorer app
from explorer.assistant import models as assistant_models # noqa
from explorer.telemetry import Stat, StatNames
from explorer.utils import (
extract_params, get_params_for_url, get_s3_bucket, passes_blacklist, s3_url,
Expand All @@ -21,7 +19,7 @@

# Issue #618. All models must be imported so that Django understands how to manage migrations for the app
from explorer.ee.db_connections.models import DatabaseConnection # noqa
from explorer.assistant.models import PromptLog # noqa
from explorer.assistant.models import PromptLog, TableDescription # noqa

MSG_FAILED_BLACKLIST = "Query failed the SQL blacklist: %s"

Expand Down
13 changes: 13 additions & 0 deletions explorer/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from explorer.utils import user_can_see_query
from explorer.ee.db_connections.utils import default_db_connection
from explorer.schema import connection_schema_cache_key, connection_schema_json_cache_key
from explorer.assistant.models import TableDescription


def reload_app_settings():
Expand Down Expand Up @@ -1173,3 +1174,15 @@ def test_database_connection_delete_view(self):
def test_database_connection_upload_view(self):
response = self.client.get(reverse("explorer_upload_create"))
self.assertEqual(response.status_code, 200)

def test_table_description_list_view(self):
td = TableDescription(database_connection=default_db_connection(), table_name="foo", description="annotated")
td.save()
response = self.client.get(reverse("table_description_list"))
self.assertEqual(response.status_code, 200)

response = self.client.get(reverse("table_description_update", args=[td.pk]))
self.assertEqual(response.status_code, 200)

response = self.client.get(reverse("table_description_create"))
self.assertEqual(response.status_code, 200)

0 comments on commit 8d2b76a

Please sign in to comment.