def test_when_using_an_auth_type_it_checks_preferences( self, mock_requests_session, ): with patch.dict(SESSIONS, {OAUTH2: mock_get_oauth2_sesh}, clear=True): get_session(self.opts, self.prefs, TEMP_FILE) assert mock_get_oauth2_sesh.called_once() assert mock_requests_session.not_called()
def test_can_instantiate_with_no_auth( self, mock_requests_session, ): self.prefs['auth_type'] = None with patch.dict(SESSIONS, {OAUTH2: mock_get_oauth2_sesh}, clear=True): get_session(self.opts, self.prefs, TEMP_FILE) assert mock_requests_session.called_once() assert mock_get_oauth2_sesh.not_called()
def setUp(self): self.prefs = deepcopy(TEST_PREFERENCES) self.prefs['auth_type'] = None self.opts = deepcopy(TEST_OPTIONS) self.sesh = get_session(self.opts, self.prefs, TEMP_FILE) super().setUp()