Skip to content

Commit

Permalink
cleaner WebAuthProvider tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Nov 23, 2016
1 parent e03da2b commit 9cf7e80
Show file tree
Hide file tree
Showing 2 changed files with 448 additions and 468 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/**
* OAuth2 Web Authentication Provider.
* It can use an external browser by sending the {@link android.content.Intent#ACTION_VIEW} intent or also the {@link WebAuthActivity}.
* This behaviour is changed using {@link WebAuthProvider#useBrowser()}, and defaults to use browser.
* This behaviour is changed using {@link WebAuthProvider.Builder#useBrowser(boolean)}, and defaults to use browser.
*/
public class WebAuthProvider {

Expand Down Expand Up @@ -479,7 +479,8 @@ private boolean shouldUsePKCE() {
return getResponseType().contains(RESPONSE_TYPE_CODE) && PKCE.isAvailable();
}

private Uri buildAuthorizeUri() {
@VisibleForTesting
Uri buildAuthorizeUri() {
final Uri authorizeUri = Uri.parse(account.getAuthorizeUrl());
String redirectUri = helper.getCallbackURI(account.getDomainUrl());
final Map<String, String> queryParameters = new HashMap<>(parameters);
Expand Down Expand Up @@ -523,43 +524,19 @@ static WebAuthProvider getInstance() {
return providerInstance;
}

boolean useBrowser() {
return useBrowser;
}

boolean useFullscreen() {
return useFullscreen;
}

String getState() {
private String getState() {
return parameters.get(KEY_STATE);
}

String getNonce() {
private String getNonce() {
return parameters.get(KEY_NONCE);
}

String getScope() {
return this.parameters.get(KEY_SCOPE);
}

String getConnectionScope() {
return parameters.get(KEY_CONNECTION_SCOPE);
}

String getResponseType() {
private String getResponseType() {
return parameters.get(KEY_RESPONSE_TYPE);
}

boolean useCodeGrant() {
return parameters.get(KEY_RESPONSE_TYPE).contains(RESPONSE_TYPE_CODE);
}

Map<String, String> getParameters() {
return parameters;
}

String getConnection() {
private String getConnection() {
return parameters.get(KEY_CONNECTION);
}
}
Loading

0 comments on commit 9cf7e80

Please sign in to comment.