aboutsummaryrefslogtreecommitdiff
path: root/tests/models/gr/test_base.py
blob: 323d7b63d31e15e7ea95e92fe5a1500966e3aa3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from typing import Callable

from pydantic import PostgresDsn

from generalresearch.pg_helper import PostgresConfig


class TestGRPostgresDjangoCreation:

    def test_django_creation(
        self,
        django_db_factory: Callable[..., None],
    ):

        dsn = django_db_factory("gr_carer")
        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