From 1a9b2ef125a1d4dbbf5e96d8990becebb9d2234c Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Mon, 10 Apr 2017 19:44:54 +0300 Subject: [PATCH] [tests] Fix osm auth tests --- editor/osm_auth.cpp | 6 +++--- editor/osm_auth_tests/osm_auth_tests.cpp | 26 ------------------------ 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/editor/osm_auth.cpp b/editor/osm_auth.cpp index b6a27d10b0..8debdc03dd 100644 --- a/editor/osm_auth.cpp +++ b/editor/osm_auth.cpp @@ -91,14 +91,14 @@ OsmOAuth OsmOAuth::ServerAuth(TKeySecret const & userKeySecret) noexcept OsmOAuth OsmOAuth::IZServerAuth() noexcept { constexpr char const * kIZTestServer = "http://test.osmz.ru"; - constexpr char const * kIZConsumerKey = "QqwiALkYZ4Jd19lo1dtoPhcwGQUqMCMeVGIQ8Ahb"; - constexpr char const * kIZConsumerSecret = "wi9HZKFoNYS06Yad5s4J0bfFo2hClMlH7pXaXWS3"; + constexpr char const * kIZConsumerKey = "F0rURWssXDYxtm61279rHdyu3iSLYSP3LdF6DL3Y"; + constexpr char const * kIZConsumerSecret = "IoR5TAedXxcybtd5tIBZqAK07rDRAuFMsQ4nhAP6"; return OsmOAuth(kIZConsumerKey, kIZConsumerSecret, kIZTestServer, kIZTestServer); } // static OsmOAuth OsmOAuth::DevServerAuth() noexcept { - constexpr char const * kOsmDevServer = "http://master.apis.dev.openstreetmap.org"; + constexpr char const * kOsmDevServer = "https://master.apis.dev.openstreetmap.org"; constexpr char const * kOsmDevConsumerKey = "eRtN6yKZZf34oVyBnyaVbsWtHIIeptLArQKdTwN3"; constexpr char const * kOsmDevConsumerSecret = "lC124mtm2VqvKJjSh35qBpKfrkeIjpKuGe38Hd1H"; return OsmOAuth(kOsmDevConsumerKey, kOsmDevConsumerSecret, kOsmDevServer, kOsmDevServer); diff --git a/editor/osm_auth_tests/osm_auth_tests.cpp b/editor/osm_auth_tests/osm_auth_tests.cpp index cb5fc1d622..115ef2846d 100644 --- a/editor/osm_auth_tests/osm_auth_tests.cpp +++ b/editor/osm_auth_tests/osm_auth_tests.cpp @@ -11,8 +11,6 @@ constexpr char const * kIZTestUser = "Testuser"; constexpr char const * kIZTestPassword = "testtest"; constexpr char const * kIZInvalidPassword = "123"; constexpr char const * kIZForgotPasswordEmail = "test@example.com"; -constexpr char const * kFacebookToken = "EAAYYoGXMFUcBAMnNx2DoyvArn2ZBq8rvZBunMB6f7lEqpvJ7es8l6N92ZA5kZA2OElpFKgJRbQXXzZBnqqDx3s9qgc542YDR73eJjkUb8OpZC6dxZAE8cjlzLmgczyVGb0vTBURgzcrbb9Sij9K2ZBQ9bR9NnAzDC0UWrd0cof1vhrHpKbGLZCaJYMbbIJbNLg6cZD"; -//constexpr char const * kGoogleToken = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjVhZDc2OGE1ZDhjMTJlYmE3OGJiY2M5Yjg1ZGNlMzJhYzFjZGM3MzYifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiI0MTgwNTMwODI0ODktaTk3MGYwbHJvYjhsNGo1aTE2a2RlOGMydnBzODN0Y2wuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMTQxMTI2Njc5NzEwNTQ0MTk2OTMiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiYXpwIjoiNDE4MDUzMDgyNDg5LTN2a2RzZ2E3cm9pNjI4ZGh2YTZydnN0MmQ4MGY5NWZuLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZW1haWwiOiJ6dmVyaWtAdGV4dHVhbC5ydSIsImlhdCI6MTQ1MjI2ODI0NCwiZXhwIjoxNDUyMjcxODQ0LCJuYW1lIjoiSWx5YSBadmVyZXYiLCJnaXZlbl9uYW1lIjoiSWx5YSIsImZhbWlseV9uYW1lIjoiWnZlcmV2IiwibG9jYWxlIjoicnUifQ.E55Fwdt--Jln6p-eKZS18U3KNf0233hfJtLZywOxGs9HMiZNG6xZrYwPM8OFGMhweplITtCokZR54wYDD113HH5Bmt5DbdZXgGZ8mZmqS3U_toNeHWI92Zfhew08OUDF_pR1ykV76KqjW4QGQnmeEYYs4O4I2Xw3nyUTAeTxleBHTgBNW-XZHTQc0l_gr3cWULCTuGOKGTSAO6ccVx34r8n1wfbHmWYGEtdNpJxK_AVCl64pCoXL-uEV7Cp3nSKFSW4Ei6b-DW6hygVuhMNWDUZGvxLm8CbQTOHTRRCpM5vuhcPEAQHlxZrmEpU7lLXZCDBEvM9JdDvDicg_WQNf3w"; } // namespace UNIT_TEST(OSM_Auth_InvalidLogin) @@ -36,30 +34,6 @@ UNIT_TEST(OSM_Auth_Login) TEST_NOT_EQUAL(perm.second.find("write_api"), string::npos, ("can write to api")); } -UNIT_TEST(OSM_Auth_Facebook) -{ - OsmOAuth auth = OsmOAuth::IZServerAuth(); - bool result; - TEST_NO_THROW(result = auth.AuthorizeFacebook(kFacebookToken), ()); - TEST_EQUAL(result, true, ("login via facebook")); - TEST(auth.IsAuthorized(), ("Should be authorized.")); - OsmOAuth::Response const perm = auth.Request("/permissions"); - TEST_EQUAL(perm.first, OsmOAuth::HTTP::OK, ("permission with stored token request ok")); - TEST_NOT_EQUAL(perm.second.find("write_api"), string::npos, ("can write to api")); -} - -// TODO(@Zverik): Fix Google auth and uncomment test. -/*UNIT_TEST(OSM_Auth_Google) -{ - OsmOAuth auth(kConsumerKey, kConsumerSecret, kTestServer, kTestServer); - auto result = auth.AuthorizeGoogle(kGoogleToken); - TEST_EQUAL(result, OsmOAuth::AuthResult::OK, ("login via google")); - TEST(auth.IsAuthorized(), ("authorized")); - OsmOAuth::Response const perm = auth.Request("/permissions"); - TEST_EQUAL(perm.first, OsmOAuth::ResponseCode::OK, ("permission with stored token request ok")); - TEST(perm.second.find("write_api") != string::npos, ("can write to api")); -}*/ - UNIT_TEST(OSM_Auth_ForgotPassword) { OsmOAuth auth = OsmOAuth::IZServerAuth();