diff --git a/editor/editor_tests/server_api_test.cpp b/editor/editor_tests/server_api_test.cpp index 9d29cfb239..86e6608abb 100644 --- a/editor/editor_tests/server_api_test.cpp +++ b/editor/editor_tests/server_api_test.cpp @@ -21,8 +21,8 @@ UNIT_TEST(OSM_ServerAPI_TestUserExists) { OsmOAuth auth(kOsmConsumerKey, kOsmConsumerSecret, kOsmDevServer); ServerApi06 api(auth); - TEST(api.TestUserExists(kValidOsmUser), ()); - TEST(!api.TestUserExists(kInvalidOsmUser), ()); + TEST_EQUAL(OsmOAuth::ResponseCode::OK, api.TestUserExists(kValidOsmUser), ()); + TEST_EQUAL(OsmOAuth::ResponseCode::NotFound, api.TestUserExists(kInvalidOsmUser), ()); } namespace diff --git a/editor/server_api.cpp b/editor/server_api.cpp index 0468d33469..47977a8c80 100644 --- a/editor/server_api.cpp +++ b/editor/server_api.cpp @@ -94,11 +94,10 @@ bool ServerApi06::CloseChangeSet(uint64_t changesetId) const return false; } -bool ServerApi06::TestUserExists(string const & userName) +OsmOAuth::ResponseCode ServerApi06::TestUserExists(string const & userName) { string const method = "/user/" + UrlEncode(userName); - OsmOAuth::Response const response = m_auth.DirectRequest(method, false); - return response.first == OsmOAuth::ResponseCode::OK; + return m_auth.DirectRequest(method, false).first; } string ServerApi06::GetXmlFeaturesInRect(m2::RectD const & latLonRect) const diff --git a/editor/server_api.hpp b/editor/server_api.hpp index 713e6aebd6..fb0149dbf1 100644 --- a/editor/server_api.hpp +++ b/editor/server_api.hpp @@ -28,7 +28,8 @@ public: ServerApi06(OsmOAuth & auth); /// This function can be used to check if user did not confirm email validation link after registration. - bool TestUserExists(string const & userName); + /// @returns OK if user exists, NotFound if it is not, and ServerError if there is no connection. + OsmOAuth::ResponseCode TestUserExists(string const & userName); /// Please use at least created_by=* and comment=* tags. bool CreateChangeSet(TKeyValueTags const & kvTags, uint64_t & outChangeSetId) const; /// nodeXml should be wrapped into ... tags.