File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/django-google-spanner/tests/unit/django_spanner Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,16 @@ 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+ def __init__ (self , * args , ** kwargs ):
42+ pass
43+
44+ def __getattr__ (self , name ):
45+ return mock .MagicMock ()
46+
47+ with mock .patch ("django_spanner.base.spanner" ):
48+ self .db_wrapper .connection = mock_connection = DummyConnection ()
49+ self .db_wrapper .init_connection_state ()
4450
4551 def test_create_cursor (self ):
4652 self .db_wrapper .connection = mock_connection = mock .MagicMock ()
You can’t perform that action at this time.
0 commit comments