##// END OF EJS Templates
tests: Adapt vcs test to check that the session factory returns the same session object.
Martin Bornhold -
r288:afa60f33 default
parent child Browse files
Show More
@@ -76,12 +76,15 b' def test_repo_maker_uses_session_for_ins'
76 'http://server_and_port/endpoint', data=mock.ANY)
76 'http://server_and_port/endpoint', data=mock.ANY)
77
77
78
78
79 @mock.patch('rhodecode.lib.vcs.client_http.ThreadlocalSessionFactory')
79 @mock.patch('rhodecode.lib.vcs.connection')
80 @mock.patch('rhodecode.lib.vcs.connection')
80 def test_connect_passes_in_the_same_session(connection, stub_session):
81 def test_connect_passes_in_the_same_session(connection, session_factory_class,
81 session_factory_patcher = mock.patch.object(
82 stub_session):
82 vcs, '_create_http_rpc_session', return_value=stub_session)
83 session_factory = session_factory_class.return_value
83 with session_factory_patcher:
84 session_factory.return_value = stub_session
84 vcs.connect_http('server_and_port')
85
85 assert connection.Hg._session == stub_session
86 vcs.connect_http('server_and_port')
86 assert connection.Svn._session == stub_session
87
87 assert connection.Git._session == stub_session
88 assert connection.Hg._session_factory() == stub_session
89 assert connection.Svn._session_factory() == stub_session
90 assert connection.Git._session_factory() == stub_session
General Comments 0
You need to be logged in to leave comments. Login now