autowisp.tests.test_project_creation_guard module

Class Inheritance Diagram

Inheritance diagram of DatabaseError, TestNewProjectGuard

Unit tests for the guard against creating a project over another one.

Project creation drops and recreates every AutoWISP table, so pointing a new project at a database that already holds them destroys whichever project lives there. These exercise set_project_home(new_project=True) against throwaway SQLite databases – the check is backend-independent (it compares table names), so SQLite covers the centralised case too.

class autowisp.tests.test_project_creation_guard.TestNewProjectGuard(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_project_creation_guard.TestNewProjectGuard

new_project=True refuses a non-empty AutoWISP database.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_creation_in_empty_home_succeeds()[source]

A fresh directory is a valid home for a new project.

test_opening_existing_project_still_allowed()[source]

Without new_project the same call just reconnects.

test_recreating_over_existing_project_refused()[source]

A second creation against the same database is rejected.

test_refused_centralised_url_is_not_persisted()[source]

A rejected db_url leaves no autowisp_db.url behind.

Otherwise the half-created project home would keep pointing at the database it was just refused.