| 32 | namespace |
| 33 | { |
| 34 | ServerApi06 CreateAPI() |
| 35 | { |
| 36 | OsmOAuth auth = OsmOAuth::DevServerAuth(); |
| 37 | bool result; |
| 38 | TEST_NO_THROW(result = auth.AuthorizePassword(kValidOsmUser, kValidOsmPassword), ()); |
| 39 | TEST_EQUAL(result, true, ("Invalid login or password?")); |
| 40 | TEST(auth.IsAuthorized(), ("OSM authorization")); |
| 41 | ServerApi06 api(auth); |
| 42 | // Test user preferences reading along the way. |
| 43 | osm::UserPreferences prefs; |
| 44 | TEST_NO_THROW(prefs = api.GetUserPreferences(), ()); |
| 45 | TEST_EQUAL(prefs.m_displayName, kValidOsmUser, ("User display name")); |
| 46 | TEST_EQUAL(prefs.m_id, 14235, ("User id")); |
| 47 | return api; |
| 48 | } |
| 49 | |
| 50 | // Returns random coordinate to avoid races when several workers run tests at the same time. |
| 51 | ms::LatLon RandomCoordinate() |
no test coverage detected