forked from photo/mobile-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue photo#459 (Card 7) (Multi-site login)
app: - Credentials: renamed mServer field to mHost. Added getHost method and changed internals of getServer method. - Credentials: removed setters for fields - LoginUtils.SelectAccountDialogFragment: replaced emails with host in the select account dialog test: - CredentialsTest: added checkCredentialsV2 method - AccountTroveboxResponseTest: added testMultiResponseV2 test - res/raw/json_login_multiple_v2.txt: added
- Loading branch information
1 parent
69066ea
commit c35fa49
Showing
5 changed files
with
165 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
{ | ||
"message":"User logged in successfully.", | ||
"code":200, | ||
"result":[ | ||
{ | ||
"_owner":"[email protected]", | ||
"_type":"owner", | ||
"host":"test.trovebox.com", | ||
"id":"102230629a6802fbca9825a4617bfe", | ||
"owner":"[email protected]", | ||
"actor":"[email protected]", | ||
"name":"Jaisen's Phone", | ||
"clientSecret":"0f5d654bca", | ||
"userToken":"b662440d621f2f71352f8865888fe2", | ||
"userSecret":"6d1e8fc274", | ||
"type":"access", | ||
"status":"1", | ||
"dateCreated":1381190570, | ||
"profile":{ | ||
"id":"test.trovebox.com", | ||
"photoUrl":"http:\/\/d1odebs29o9vbg.cloudfront.net\/custom\/196912\/27005_original-526fb8_100x100xCR.jpg", | ||
"counts":{ | ||
"photos":397, | ||
"albums":27, | ||
"tags":141, | ||
"storage":316116992, | ||
"storage_str":"316116992" | ||
}, | ||
"name":"Trovebox Test Name", | ||
"limit":{ | ||
"allowed":100, | ||
"remaining":2147483647, | ||
"resetsOn":1383289200, | ||
"resetsInDays":25 | ||
}, | ||
"paid":true, | ||
"email":"[email protected]", | ||
"isOwner":true, | ||
"permission":{ | ||
"C":true, | ||
"R":true, | ||
"U":true, | ||
"D":true | ||
} | ||
} | ||
}, | ||
{ | ||
"_owner":"[email protected]", | ||
"_type":"admin", | ||
"host":"test2.trovebox.com", | ||
"id":"102230629a6802fbca9825a4617bfe", | ||
"owner":"[email protected]", | ||
"actor":"[email protected]", | ||
"name":"Jaisen's Phone", | ||
"clientSecret":"0f5d654bca", | ||
"userToken":"b662440d621f2f71352f8865888fe2", | ||
"userSecret":"6d1e8fc274", | ||
"type":"access", | ||
"status":"1", | ||
"dateCreated":1381190570, | ||
"profile":{ | ||
"id":"test2.trovebox.com", | ||
"photoUrl":"http:\/\/www.gravatar.com\/avatar\/98d3a0767a868b52f7e320340d35bc45?s=100&d=http%2F%2Fdm5ing2l7y91e.cloudfront.net%2Fassets%2Fthemes%2Ffabrizio1.0%2Fimages%2Fprofile-default.png", | ||
"counts":{ | ||
"photos":55, | ||
"albums":5, | ||
"tags":20, | ||
"storage":121390080, | ||
"storage_str":"121390080" | ||
}, | ||
"name":"Trovebox User", | ||
"limit":{ | ||
"allowed":100, | ||
"remaining":2147483647, | ||
"resetsOn":1383289200, | ||
"resetsInDays":25 | ||
}, | ||
"paid":true, | ||
"email":"[email protected]", | ||
"isOwner":true, | ||
"permission":{ | ||
"C":true, | ||
"R":true, | ||
"U":true, | ||
"D":true | ||
} | ||
} | ||
}, | ||
{ | ||
"_owner":"[email protected]", | ||
"_type":"group", | ||
"host":"test3.trovebox.com", | ||
"id":"102230629a6802fbca9825a4617bfe", | ||
"owner":"[email protected]", | ||
"actor":"[email protected]", | ||
"name":"Jaisen's Phone", | ||
"clientSecret":"0f5d654bca", | ||
"userToken":"b662440d621f2f71352f8865888fe2", | ||
"userSecret":"6d1e8fc274", | ||
"type":"access", | ||
"status":"1", | ||
"dateCreated":1381190570, | ||
"profile":{ | ||
"id":"test3.trovebox.com", | ||
"photoUrl":"http:\/\/awesomeness.openphoto.me\/custom\/201203\/62f010-Boracay-Philippines-033_100x100xCR.jpg", | ||
"counts":{ | ||
"photos":363, | ||
"albums":5, | ||
"tags":37 | ||
}, | ||
"name":" Demo User", | ||
"isOwner":false, | ||
"permission":{ | ||
"C":[ | ||
4 | ||
], | ||
"R":[ | ||
4 | ||
], | ||
"U":false, | ||
"D":false | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,21 @@ public void testMultiResponse() throws JSONException { | |
CredentialsTest.checkCredentials(credentials[0], "[email protected]"); | ||
CredentialsTest.checkCredentials(credentials[1], "[email protected]"); | ||
} | ||
|
||
public void testMultiResponseV2() throws JSONException { | ||
JSONObject json = JSONUtils.getJson(getInstrumentation().getContext(), | ||
R.raw.json_login_multiple_v2); | ||
AccountTroveboxResponse response = new AccountTroveboxResponse(RequestType.UNKNOWN, json); | ||
assertNotNull(response); | ||
assertEquals(200, response.getCode()); | ||
Credentials[] credentials = response.getCredentials(); | ||
assertNotNull(credentials); | ||
assertTrue(credentials.length == 3); | ||
CredentialsTest.checkCredentialsV2(credentials[0], "[email protected]", | ||
"http://test.trovebox.com"); | ||
CredentialsTest.checkCredentialsV2(credentials[1], "[email protected]", | ||
"http://test2.trovebox.com"); | ||
CredentialsTest.checkCredentialsV2(credentials[2], "[email protected]", | ||
"http://test3.trovebox.com"); | ||
} | ||
} |