Skip to content

Commit

Permalink
Fixing the issue of not being able to add a new project for personal …
Browse files Browse the repository at this point in the history
…accounts. (#48)

* Add deps
- github.com/stretchr/testify/assert
- github.com/stretchr/testify/require

* Omit orgaization_slug from create app request if empty
  • Loading branch information
adborbas authored Jan 28, 2021
1 parent 42984b5 commit b8350f0
Show file tree
Hide file tree
Showing 51 changed files with 22,616 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.7.0"
2 changes: 1 addition & 1 deletion bitriseio/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type RegisterParams struct {
IsPublic bool `json:"is_public"`
Provider string `json:"provider"`
RepoURL string `json:"repo_url"`
OrganizationSlug string `json:"organization_slug"`
OrganizationSlug string `json:"organization_slug,omitempty"`
}

// Register ...
Expand Down
41 changes: 41 additions & 0 deletions phases/register_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package phases

import (
"encoding/json"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestRegistrationParams(t *testing.T) {
type testCase struct {
organizationSlug string
isExpectedInJSON bool
}
testCases := []testCase{
{
"",
false,
},
{
"notempty",
true,
},
}

for _, test := range testCases {
// Given
progress := Progress{}
progress.OrganizationSlug = test.organizationSlug

// When
params, err := toRegistrationParams(progress)
bytes, err := json.Marshal(params)

// Then
require.NoError(t, err)
assert.Equal(t, test.isExpectedInJSON, strings.Contains(string(bytes), "organization_slug"))
}
}
15 changes: 15 additions & 0 deletions vendor/github.com/davecgh/go-spew/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

145 changes: 145 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b8350f0

Please sign in to comment.