def test_iam_get_session_info(self, m_get): m_info = '{"ok": true, "info": {"authentication_db": "_users"}}' m_response = mock.MagicMock() type(m_response).text = mock.PropertyMock(return_value=m_info) m_get.return_value = m_response iam = IAMSession(MOCK_API_KEY, 'http://127.0.0.1:5984') info = iam.info() m_get.assert_called_once_with(iam._session_url) self.assertEqual(info, json.loads(m_info)) self.assertTrue(m_response.raise_for_status.called)
def test_iam_get_session_info(self, m_get): m_info = {'ok': True, 'info': {'authentication_db': '_users'}} m_response = mock.MagicMock() m_response.json.return_value = m_info m_get.return_value = m_response iam = IAMSession(MOCK_API_KEY, 'http://127.0.0.1:5984') info = iam.info() m_get.assert_called_once_with(iam._session_url) self.assertEqual(info, m_info) self.assertTrue(m_response.raise_for_status.called)