Esempio n. 1
0
 def test_from_environ_override_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("ENVIRONMENT", "yacht_club")
     monkeypatch.setenv("YACHT_CLUB_DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 2
0
 def test_from_environ_default_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.delenv("ENVIRONMENT", raising=False)
     monkeypatch.setenv("DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 3
0
 def test_from_environ_override_not_exists(self, monkeypatch):
     monkeypatch.setenv("ENVIRONMENT", "yacht_club")
     monkeypatch.delenv("YACHT_CLUB_DATABASE_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env()
     assert ex.value.message == "YACHT_CLUB_DATABASE_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 4
0
File: test_db.py Progetto: palbee/db
 def test_from_environ_override_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("ENVIRONMENT", "yacht_club")
     monkeypatch.setenv("YACHT_CLUB_DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 5
0
 def test_from_environ_default_not_exists(self, monkeypatch):
     monkeypatch.delenv("ENVIRONMENT", raising=False)
     monkeypatch.delenv("DATABASE_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env()
     assert ex.value.message == "DATABASE_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 6
0
File: test_db.py Progetto: palbee/db
 def test_from_environ_default_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.delenv("ENVIRONMENT", raising=False)
     monkeypatch.setenv("DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 7
0
File: test_db.py Progetto: palbee/db
 def test_from_environ_override_not_exists(self, monkeypatch):
     monkeypatch.setenv("ENVIRONMENT", "yacht_club")
     monkeypatch.delenv("YACHT_CLUB_DATABASE_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env()
     assert ex.value.message == "YACHT_CLUB_DATABASE_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 8
0
File: test_db.py Progetto: palbee/db
 def test_from_environ_default_not_exists(self, monkeypatch):
     monkeypatch.delenv("ENVIRONMENT", raising=False)
     monkeypatch.delenv("DATABASE_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env()
     assert ex.value.message == "DATABASE_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 9
0
 def test_from_env_bad_url(self, monkeypatch):
     monkeypatch.setenv("DATABASE_URL", "bad bad url")
     with pytest.raises(db.InvalidDatabaseURL) as ex:
         db.from_env()
     assert ex.value.message == "bad bad url"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 10
0
 def test_from_env_override_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("ALT_URL", MEM_URL)
     db.from_env("ALT_URL")
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 11
0
 def test_from_env_override_not_exists(self, monkeypatch):
     monkeypatch.delenv("ALT_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env("ALT_URL")
     assert ex.value.message == "ALT_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 12
0
 def test_from_env_default_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 13
0
File: test_db.py Progetto: palbee/db
 def test_from_env_bad_url(self, monkeypatch):
     monkeypatch.setenv("DATABASE_URL", "bad bad url")
     with pytest.raises(db.InvalidDatabaseURL) as ex:
         db.from_env()
     assert ex.value.message == "bad bad url"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 14
0
File: test_db.py Progetto: palbee/db
 def test_from_env_override_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("ALT_URL", MEM_URL)
     db.from_env("ALT_URL")
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1
Esempio n. 15
0
File: test_db.py Progetto: palbee/db
 def test_from_env_override_not_exists(self, monkeypatch):
     monkeypatch.delenv("ALT_URL", raising=False)
     with pytest.raises(KeyError) as ex:
         db.from_env("ALT_URL")
     assert ex.value.message == "ALT_URL"
     assert len(db.drivers._DRIVERS) == 0
Esempio n. 16
0
File: test_db.py Progetto: palbee/db
 def test_from_env_default_exists(self, monkeypatch):
     db.drivers.autoregister_class(db_sqlite3.Sqlite3Driver)
     monkeypatch.setenv("DATABASE_URL", MEM_URL)
     db.from_env()
     assert "sqlite3" in db.drivers._DRIVERS
     assert len(db.drivers._DRIVERS) == 1