diff options
Diffstat (limited to 'tests/models')
| -rw-r--r-- | tests/models/gr/test_base.py | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/tests/models/gr/test_base.py b/tests/models/gr/test_base.py index 323d7b6..a9f01a8 100644 --- a/tests/models/gr/test_base.py +++ b/tests/models/gr/test_base.py @@ -1,5 +1,8 @@ +import subprocess +from pathlib import Path from typing import Callable +import pytest from pydantic import PostgresDsn from generalresearch.pg_helper import PostgresConfig @@ -7,19 +10,37 @@ from generalresearch.pg_helper import PostgresConfig class TestGRPostgresDjangoCreation: + def test_git(self, git_key_path: Path, gr_repo: Callable[..., Path]): + repo_path = gr_repo() + + try: + # Run the git command inside the target directory + result = subprocess.run( + ["git", "rev-parse", "--is-inside-work-tree"], + cwd=repo_path, + capture_output=True, + text=True, + check=True, + ) + # Check if the output string is exactly "true" + assert result.stdout.strip() == "true" + + except (subprocess.CalledProcessError, FileNotFoundError) as e: + pytest.fail(f"Directory is not a Git repo or Git is not installed: {e}") + def test_django_creation( self, django_db_factory: Callable[..., None], ): - dsn = django_db_factory("gr_carer") + dsn = django_db_factory("gr") 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 + # 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 |
