11using Mantid::Catalog::OAuth::IOAuthTokenStore;
12using Mantid::Catalog::OAuth::IOAuthTokenStore_uptr;
13using Mantid::Catalog::OAuth::OAuthToken;
21 for (
const auto &mapping : responseMap) {
53 const auto statusCode = mockResponse->second.first;
54 const auto responseBody = mockResponse->second.second;
59 throw InternetError(responseBody,
static_cast<int>(statusCode));
62 responseStream << responseBody;
68 return std::make_shared<MockONCatAPI>(responseMap);
73 auto oncat = ONCat::fromMantidSettings();
74 oncat->setInternetHelper(mockAPI);
87 auto tokenStore = std::make_unique<MockTokenStore>();
88 tokenStore->setToken(OAuthToken(
"Bearer", 3600,
"2KSL5aEnLvIudMHIjc7LcBWBCfxOHZ",
"api:read data:read settings:read",
89 boost::make_optional<std::string>(
"eZEiz7LbgFrkL5ZHv7R4ck9gOzXexb")));
bool allResponsesCalled() const
MockResponseMap m_responseMap
bool allResponsesCalledOnce() const
InternetHelper::HTTPStatus sendHTTPSRequest(const std::string &url, std::ostream &responseStream) override
Performs a request using https.
MockResponseCallCounts m_responseCallCounts
InternetHelper::HTTPStatus sendHTTPRequest(const std::string &url, std::ostream &responseStream) override
Performs a request using http.
void setToken(const boost::optional< OAuthToken > &token) override
boost::optional< OAuthToken > m_token
boost::optional< OAuthToken > getToken() override
Exception thrown when error occurs accessing an internet resource.
Marks code as not implemented yet.
InternetHelper : A helper class for supporting access to resources through HTTP and HTTPS.
std::shared_ptr< MockONCatAPI > make_mock_oncat_api(const MockResponseMap &responseMap)
std::map< std::string, std::pair< InternetHelper::HTTPStatus, std::string > > MockResponseMap
IOAuthTokenStore_uptr make_mock_token_store()
std::unique_ptr< ONCat > make_oncat_with_mock_api(const std::shared_ptr< MockONCatAPI > &mockAPI)
std::pair< const std::basic_string< char >, unsigned int > MockResponseCallMapping
IOAuthTokenStore_uptr make_mock_token_store_already_logged_in()
Helper class which provides the Collimation Length for SANS instruments.