aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/config_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-29 17:21:46 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-29 17:21:46 +0100
commita90954ae1a1b4d01d9695e45feb979c40ca42c9e (patch)
tree14084c3f235d2d87289d31331ba8cc583164bf3e /bridge/github/config_test.go
parentfe38af05a84abc15243bacf55a63f6f9aae37a33 (diff)
downloadgit-bug-a90954ae1a1b4d01d9695e45feb979c40ca42c9e.tar.gz
github: fix tests
Diffstat (limited to 'bridge/github/config_test.go')
-rw-r--r--bridge/github/config_test.go55
1 files changed, 32 insertions, 23 deletions
diff --git a/bridge/github/config_test.go b/bridge/github/config_test.go
index fe54c209..eecb1aa8 100644
--- a/bridge/github/config_test.go
+++ b/bridge/github/config_test.go
@@ -104,41 +104,50 @@ func TestValidateUsername(t *testing.T) {
t.Skip("Travis environment: avoiding non authenticated requests")
}
- type args struct {
- username string
- }
tests := []struct {
- name string
- args args
- want bool
+ name string
+ input string
+ fixed string
+ ok bool
}{
{
- name: "existing username",
- args: args{
- username: "MichaelMure",
- },
- want: true,
+ name: "existing username",
+ input: "MichaelMure",
+ fixed: "MichaelMure",
+ ok: true,
},
{
- name: "existing organisation name",
- args: args{
- username: "ipfs",
- },
- want: true,
+ name: "existing username with bad case",
+ input: "MicHaelmurE",
+ fixed: "MichaelMure",
+ ok: true,
},
{
- name: "non existing username",
- args: args{
- username: "cant-find-this",
- },
- want: false,
+ name: "existing organisation",
+ input: "ipfs",
+ fixed: "ipfs",
+ ok: true,
+ },
+ {
+ name: "existing organisation with bad case",
+ input: "iPfS",
+ fixed: "ipfs",
+ ok: true,
+ },
+ {
+ name: "non existing username",
+ input: "cant-find-this",
+ fixed: "",
+ ok: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- ok, _ := validateUsername(tt.args.username)
- assert.Equal(t, tt.want, ok)
+ ok, fixed, err := validateUsername(tt.input)
+ assert.NoError(t, err)
+ assert.Equal(t, tt.ok, ok)
+ assert.Equal(t, tt.fixed, fixed)
})
}
}