-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix GetDiff to use executeRaw() internally. (#84)
- Loading branch information
Showing
4 changed files
with
57 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
env: ## check env for e2e testing | ||
ifndef BITBUCKET_TEST_USERNAME | ||
$(error `BITBUCKET_TEST_USERNAME` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_PASSWORD | ||
$(error `BITBUCKET_TEST_PASSWORD` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_OWNER | ||
$(error `BITBUCKET_TEST_OWNER` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_REPOSLUG | ||
$(error `BITBUCKET_TEST_REPOSLUG` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_USERNAME | ||
$(error `BITBUCKET_TEST_USERNAME` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_PASSWORD | ||
$(error `BITBUCKET_TEST_PASSWORD` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_OWNER | ||
$(error `BITBUCKET_TEST_OWNER` is not set) | ||
endif | ||
ifndef BITBUCKET_TEST_REPOSLUG | ||
$(error `BITBUCKET_TEST_REPOSLUG` is not set) | ||
endif | ||
|
||
test: env ## run go test all | ||
go test -v ./tests | ||
|
||
help: ## print this help | ||
help: ## print this help | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: test help |
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,42 @@ | ||
package tests | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/k0kubun/pp" | ||
"github.com/ktrysmt/go-bitbucket" | ||
) | ||
|
||
func TestDiff(t *testing.T) { | ||
|
||
user := os.Getenv("BITBUCKET_TEST_USERNAME") | ||
pass := os.Getenv("BITBUCKET_TEST_PASSWORD") | ||
owner := os.Getenv("BITBUCKET_TEST_OWNER") | ||
repo := os.Getenv("BITBUCKET_TEST_REPOSLUG") | ||
|
||
if user == "" { | ||
t.Error("BITBUCKET_TEST_USERNAME is empty.") | ||
} | ||
|
||
if pass == "" { | ||
t.Error("BITBUCKET_TEST_PASSWORD is empty.") | ||
} | ||
|
||
c := bitbucket.NewBasicAuth(user, pass) | ||
|
||
spec := "master..develop" | ||
|
||
opt := &bitbucket.DiffOptions{ | ||
Owner: owner, | ||
RepoSlug: repo, | ||
Spec: spec, | ||
} | ||
res, _ := c.Repositories.Diff.GetDiff(opt) | ||
|
||
pp.Println(res) | ||
|
||
if res == nil { | ||
t.Error("It could not get the raw response.") | ||
} | ||
} |