File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/django-google-spanner/tests/unit/django_spanner Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,15 @@ def test_get_new_connection(self):
3737 mock_connection .assert_called_once_with (** conn_params )
3838
3939 def test_init_connection_state (self ):
40- self .db_wrapper .connection = mock_connection = mock .MagicMock ()
41- mock_connection .close = mock_close = mock .MagicMock ()
42- self .db_wrapper .init_connection_state ()
43- mock_close .assert_called_once_with ()
40+ class DummyConnection :
41+ autocommit = False
42+ def __init__ (self , * args , ** kwargs ):
43+ pass
44+
45+ with mock .patch ("django_spanner.base.spanner" ):
46+ self .db_wrapper .connection = mock_connection = DummyConnection ()
47+ mock_connection .close = mock_close = mock .MagicMock ()
48+ self .db_wrapper .init_connection_state ()
4449
4550 def test_create_cursor (self ):
4651 self .db_wrapper .connection = mock_connection = mock .MagicMock ()
You can’t perform that action at this time.
0 commit comments