def test_put(self, get_proxy: MagicMock, RequestParser: MagicMock) -> None: mock_proxy = get_proxy.return_value = Mock() RequestParser().parse_args.return_value = dict(data='{}', index='fake_index') response = DocumentUsersAPI().put() self.assertEqual(list(response)[1], HTTPStatus.OK) mock_proxy.update_document.assert_called_with(data=[], index='fake_index')
def test_post(self, get_proxy: MagicMock, RequestParser: MagicMock, UserSchema: MagicMock) -> None: mock_proxy = get_proxy.return_value = Mock() RequestParser().parse_args.return_value = dict(data='{}', index='fake_index') expected_value = UserSchema().loads.return_value = Mock() response = DocumentUsersAPI().post() self.assertEqual(list(response)[1], HTTPStatus.OK) mock_proxy.create_document.assert_called_with(data=expected_value, index='fake_index')