Permalink
Browse files

Fixing errors in tests/

  • Loading branch information...
1 parent 9cbf347 commit 5fec77c53fec0692047cf5d512a696d53edde42f Jim Brusstar committed Dec 10, 2010
Showing with 14 additions and 26 deletions.
  1. +2 −2 tests/default.properties
  2. +12 −24 tests/src/com/facebook/android/tests/Tests.java
View
@@ -7,6 +7,6 @@
# "build.properties", and override values to adapt the script to your
# project structure.
-android.library.reference.1=../b5/facebook-android-sdk/facebook/
+android.library.reference.1=../facebook/
# Project target.
-target=android-3
+target=android-8
@@ -44,7 +44,7 @@
Button logoutButton;
TextView logoutText;
- Facebook authenticatedFacebook = new Facebook();
+ Facebook authenticatedFacebook = new Facebook(APP_ID);
/** Called when the activity is first created. */
@Override
@@ -68,8 +68,8 @@ public void onCreate(Bundle savedInstanceState) {
// button to test UI Server login method
loginButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- authenticatedFacebook.authorize(Tests.this,
- APP_ID, PERMISSIONS, new TestLoginListener());
+ authenticatedFacebook.authorize(Tests.this, PERMISSIONS,
+ new TestLoginListener());
}
});
@@ -115,7 +115,7 @@ public void runTestPublicApi() {
}
public boolean testPublicApi() {
- Facebook fb = new Facebook();
+ Facebook fb = new Facebook(APP_ID);
try {
Log.d("Tests", "Testing standard API call");
JSONObject response = Util.parseJson(fb.request("4"));
@@ -145,7 +145,7 @@ public boolean testPublicApi() {
}
public boolean testPublicErrors() {
- Facebook fb = new Facebook();
+ Facebook fb = new Facebook(APP_ID);
try {
Bundle params = new Bundle();
@@ -167,7 +167,9 @@ public boolean testPublicErrors() {
return false;
} catch (FacebookError e) {
Log.d("Tests", "*" + e.getMessage() + "*");
- if (!e.getMessage().equals("Unsupported delete request.")) {
+ if (!e.getMessage().equals(
+ "An access token is required to request this " +
+ "resource.")) {
return false;
}
}
@@ -227,8 +229,8 @@ public boolean testPublicErrors() {
} catch (FacebookError e) {
Log.d("Tests", "*" + e.getMessage() + "*");
if (!e.getMessage().equals(
- "Some of the aliases you requested do not exist: " +
- "invalidinvalidinvalidinvalid")) {
+ "(#803) Some of the aliases you requested do not " +
+ "exist: invalidinvalidinvalidinvalid")) {
return false;
}
}
@@ -532,8 +534,6 @@ public void runTestLogout() {
public boolean testLogout() {
try {
- String oldAccessToken = authenticatedFacebook.getAccessToken();
-
Log.d("Tests", "Testing logout");
String response = authenticatedFacebook.logout(this);
Log.d("Tests", "Got logout response: *" + response + "*");
@@ -554,7 +554,7 @@ public boolean testLogout() {
Log.d("Tests", "Testing logout on unauthenticated object");
try {
- Util.parseJson(new Facebook().logout(this));
+ Util.parseJson(new Facebook(APP_ID).logout(this));
return false;
} catch (FacebookError e) {
if (e.getErrorCode() != 101 ||
@@ -563,18 +563,6 @@ public boolean testLogout() {
}
}
- Log.d("Tests", "Testing that old access token no longer works");
- Facebook invalidFb = new Facebook();
- invalidFb.setAccessToken(oldAccessToken);
- try {
- Util.parseJson(invalidFb.request("me"));
- return false;
- } catch (FacebookError e) {
- if (!e.getMessage().equals("Error processing access token.")) {
- return false;
- }
- }
-
Log.d("Tests", "All Logout Tests Passed");
return true;
} catch (Throwable e) {
@@ -586,4 +574,4 @@ public boolean testLogout() {
// test bad UI server method?
// test invalid permission? <-- UI server test
-}
+}

0 comments on commit 5fec77c

Please sign in to comment.