Skip to content

Commit

Permalink
cogito:protocol: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aliculPix4D committed Oct 20, 2023
1 parent 6f61921 commit b9f3ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
9 changes: 4 additions & 5 deletions cmd/cogito/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ func TestRunPutSuccess(t *testing.T) {
chatReply := googlechat.MessageReply{}
var gchatUrl *url.URL
googleChatSpy := testhelp.SpyHttpServer(&chatMsg, chatReply, &gchatUrl, http.StatusOK)
gitHubSpyDomain, err := url.Parse(gitHubSpy.URL)
if err != nil {
t.Fatalf("error parsing SpyHttpServer URL: %s", err)
}

in := bytes.NewReader(testhelp.ToJSON(t, cogito.PutRequest{
Source: cogito.Source{
Owner: "the-owner",
Expand All @@ -85,6 +80,10 @@ func TestRunPutSuccess(t *testing.T) {
}))
var out bytes.Buffer
var logOut bytes.Buffer
gitHubSpyDomain, err := url.Parse(gitHubSpy.URL)
if err != nil {
t.Fatalf("error parsing SpyHttpServer URL: %s", err)
}
inputDir := testhelp.MakeGitRepoFromTestdata(t, "../../cogito/testdata/one-repo/a-repo",
testhelp.HttpsRemote(gitHubSpyDomain.Host, "the-owner", "the-repo"), "dummySHA", wantGitRef)

Expand Down
14 changes: 2 additions & 12 deletions cogito/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestSourceValidationFailure(t *testing.T) {
wantErr: "source: invalid sink(s): [closed coffee shop]",
},
{
name: "no protocol prefix in git source github_api_endpoint",
name: "invalid URI: missing scheme in source.github_api_endpoint",
source: cogito.Source{
Owner: "the-owner",
Repo: "the-repo",
Expand All @@ -121,7 +121,7 @@ func TestSourceValidationFailure(t *testing.T) {
wantErr: "source: github_api_endpoint 'github.coffee.com/api/v3' is an invalid api endpoint",
},
{
name: "invalid http protocol prefix in git source github_api_endpoint",
name: "invalid URI: missing authorithy in source.github_api_endpoint",
source: cogito.Source{
Owner: "the-owner",
Repo: "the-repo",
Expand All @@ -130,16 +130,6 @@ func TestSourceValidationFailure(t *testing.T) {
},
wantErr: "source: github_api_endpoint 'https:github.coffee.com/api/v3' is an invalid api endpoint",
},
{
name: "invalid http protocol prefix in git source github_api_endpoint",
source: cogito.Source{
Owner: "the-owner",
Repo: "the-repo",
AccessToken: "the-token",
GithubApiEndpoint: "john.smith.cim",
},
wantErr: "source: github_api_endpoint 'john.smith.cim' is an invalid api endpoint",
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit b9f3ff2

Please sign in to comment.