use of org.wordpress.android.ui.stats.models.FollowDataModel in project WordPress-Android by wordpress-mobile.
the class RemoteTests method testFollowersWPCOM.
public void testFollowersWPCOM() throws Exception {
StatsRestRequestAbstractListener listener = new StatsRestRequestAbstractListener() {
@Override
void parseResponse(JSONObject response) throws JSONException {
FollowersModel model = new FollowersModel(1234567890, response);
assertEquals(model.getTotalEmail(), 2930);
assertEquals(model.getTotalWPCom(), 7925800);
assertEquals(model.getTotal(), 7925800);
assertEquals(model.getPage(), 1);
assertEquals(model.getPages(), 1132258);
assertNotNull(model.getFollowers());
assertEquals(model.getFollowers().size(), 7);
FollowerModel first = model.getFollowers().get(0);
assertEquals(first.getAvatar(), "https://0.gravatar.com/avatar/624b89cb0c8b9136f9629dd7bcab0517?s=64" + "&d=https%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D64&r=G");
assertEquals(first.getLabel(), "ritu929");
assertEquals(first.getURL(), "http://ritu9blog.wordpress.com");
assertEquals(first.getDateSubscribed(), "2014-12-16T14:53:21+00:00");
assertNotNull(first.getFollowData());
FollowDataModel followDatamodel = first.getFollowData();
assertFalse(followDatamodel.isFollowing());
assertEquals(followDatamodel.getType(), "follow");
}
};
mRestClient.makeRequest(Request.Method.POST, "https://public-api.wordpress.com/rest/v1.1/sites/1234567890/stats/followers", null, listener, errListener);
}
Aggregations