first commit
This commit is contained in:
19
test/db/sql_manager_test.py
Normal file
19
test/db/sql_manager_test.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import unittest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from helix.db.sql_manager import SQLManager
|
||||
|
||||
|
||||
class SQLManagerTest(unittest.TestCase):
|
||||
def test_uses_url_if_vcap_environment_is_not_set(self):
|
||||
create_engine = MagicMock()
|
||||
|
||||
with patch('sqlalchemy.create_engine', create_engine):
|
||||
SQLManager.get_sql_session_maker('postgres://example.com')
|
||||
create_engine.assert_called_with('postgres://example.com', echo=False)
|
||||
|
||||
def test_defaults_to_local_connection_if_vcap_environment_is_not_set_and_url_is_none(self):
|
||||
create_engine = MagicMock()
|
||||
|
||||
with patch('sqlalchemy.create_engine', create_engine):
|
||||
SQLManager.get_sql_session_maker(None)
|
||||
create_engine.assert_called_with('postgres://pivotal:@localhost/pivotal', echo=True)
|
||||
Reference in New Issue
Block a user