Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Jan 24, 2025
1 parent 1e2760c commit c20b672
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_houseplant.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ def migration_with_settings(tmp_path):
return migration_content


def test_init(houseplant, tmp_path, mocker):
# Mock database calls
mock_init_migrations = mocker.patch.object(houseplant.db, "init_migrations_table")

# Change to temp directory
os.chdir(tmp_path)

# Run init
houseplant.init()

# Verify directories and files were created
assert os.path.exists("ch/migrations")
assert os.path.exists("ch/schema.sql")

# Verify migrations table was initialized
mock_init_migrations.assert_called_once()


def test_migration_with_settings(houseplant, migration_with_settings, mocker):
mock_execute = mocker.patch.object(houseplant.db.client, "execute")
settings = {"settings": {"enable_dynamic_type": 1, "max_table_size_to_drop": 0}}
Expand Down

0 comments on commit c20b672

Please sign in to comment.