-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add app password into clone url for bitbucket clones (#425)
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
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,26 @@ | ||
package scm | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestInsertAppPasswordCredentialsIntoURL(t *testing.T) { | ||
// Set environment variables for the test | ||
os.Setenv("GHORG_BITBUCKET_USERNAME", "ghorg") | ||
os.Setenv("GHORG_BITBUCKET_APP_PASSWORD", "testpassword") | ||
|
||
// Define a test URL | ||
testURL := "https://ghorg@bitbucket.org/foobar/testrepo.git" | ||
|
||
// Call the function with the test URL | ||
resultURL := insertAppPasswordCredentialsIntoURL(testURL) | ||
|
||
// Define the expected result | ||
expectedURL := "https://ghorg:testpassword@bitbucket.org/foobar/testrepo.git" | ||
|
||
// Check if the result matches the expected result | ||
if resultURL != expectedURL { | ||
t.Errorf("Expected %s, but got %s", expectedURL, resultURL) | ||
} | ||
} |