forked from rtyley/agit
-
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.
add unit test for bitbucket web launch, use https rather than ssh
I think it's better to default to https rather than ssh clone urls for this case because SSH access requires the user to have an SSH key installed - even if it's a public repo. also normalise formatting of AndroidManifest
- Loading branch information
Showing
3 changed files
with
43 additions
and
7 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
36 changes: 36 additions & 0 deletions
36
agit/src/test/java/com/madgag/agit/weblaunchers/BitBucketWebLaunchActivityTest.java
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,36 @@ | ||
package com.madgag.agit.weblaunchers; | ||
|
||
import static com.madgag.agit.GitIntents.sourceUriFrom; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
import android.net.Uri; | ||
|
||
import com.google.inject.Inject; | ||
import com.madgag.agit.InjectedTestRunner; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(InjectedTestRunner.class) | ||
public class BitBucketWebLaunchActivityTest { | ||
|
||
@Inject | ||
BitBucketWebLaunchActivity activity; | ||
|
||
@Test | ||
public void shouldSupplyCloneSourceFromBitBucketProjectPage() { | ||
String projectUrl = "https://bitbucket.org/grubix/git"; | ||
assertThat(sourceUriDerivedFrom(projectUrl), is("https://bitbucket.org/grubix/git.git")); | ||
} | ||
|
||
@Test | ||
public void shouldSupplyCloneSourceFromBitBucketCheckoutPage() { | ||
String sourceUri = sourceUriDerivedFrom("https://bitbucket.org/grubix/git/src"); | ||
assertThat(sourceUri, is("https://bitbucket.org/grubix/git.git")); | ||
} | ||
|
||
private String sourceUriDerivedFrom(String url) { | ||
return sourceUriFrom(activity.cloneLauncherForWebBrowseIntent(Uri.parse(url))); | ||
} | ||
|
||
} |