aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/models/custom_types/test_aware_datetime.py2
-rw-r--r--tests/test_postgres.py26
2 files changed, 26 insertions, 2 deletions
diff --git a/tests/models/custom_types/test_aware_datetime.py b/tests/models/custom_types/test_aware_datetime.py
index a23413c..14d1343 100644
--- a/tests/models/custom_types/test_aware_datetime.py
+++ b/tests/models/custom_types/test_aware_datetime.py
@@ -4,7 +4,7 @@ from typing import Optional
import pytest
import pytz
-from pydantic import BaseModel, ValidationError, Field
+from pydantic import BaseModel, Field, ValidationError
from generalresearch.models.custom_types import AwareDatetimeISO
diff --git a/tests/test_postgres.py b/tests/test_postgres.py
index 92eed71..3b3ddd0 100644
--- a/tests/test_postgres.py
+++ b/tests/test_postgres.py
@@ -1,9 +1,10 @@
import socket
import subprocess
+from typing import Callable
from pydantic import PostgresDsn
-from generalresearch.models.custom_types import InternalHostname
+from generalresearch.models.custom_types import InternalHostname, PostgresDict
from generalresearch.pg_helper import PostgresConfig
@@ -42,3 +43,26 @@ class TestPostgresDSN:
)
res = config.execute_sql_query(query="SELECT 1;")
assert len(res) == 1
+
+
+class TestPostgresDjangoCreation:
+
+ def test_ping(self, postgres_instance_dict: PostgresDict):
+ assert can_ping(host=postgres_instance_dict["host"])
+
+ def test_django_creation(
+ self,
+ django_db_factory: Callable[..., None],
+ ):
+
+ dsn = django_db_factory()
+ assert isinstance(dsn, PostgresDsn)
+
+ def test_django_tables(self, thl_web_rw: PostgresConfig):
+ res = thl_web_rw.execute_sql_query(query="""
+ SELECT COUNT(*)
+ FROM information_schema.tables
+ WHERE table_schema = 'public';
+ """)
+ assert len(res) == 1
+ assert res[0]["count"] == 56