integration: check when there's no secret provided
This commit is contained in:
parent
8360f18fea
commit
7d4f41bf04
1 changed files with 15 additions and 3 deletions
|
@ -144,9 +144,10 @@ func TestGetAdmin(t *testing.T) {
|
|||
|
||||
func TestCreateAdmin(t *testing.T) {
|
||||
tests := []struct {
|
||||
admn *adminschema.Admin
|
||||
errCode int
|
||||
secret string
|
||||
admn *adminschema.Admin
|
||||
errCode int
|
||||
secret string
|
||||
noSecret bool
|
||||
}{
|
||||
{
|
||||
admn: &adminschema.Admin{
|
||||
|
@ -163,6 +164,14 @@ func TestCreateAdmin(t *testing.T) {
|
|||
errCode: http.StatusUnauthorized,
|
||||
secret: "bad_secret",
|
||||
},
|
||||
{
|
||||
admn: &adminschema.Admin{
|
||||
Email: "foo@example.com",
|
||||
Password: "foopass",
|
||||
},
|
||||
errCode: http.StatusUnauthorized,
|
||||
noSecret: true,
|
||||
},
|
||||
{
|
||||
// duplicate Email
|
||||
admn: &adminschema.Admin{
|
||||
|
@ -187,6 +196,9 @@ func TestCreateAdmin(t *testing.T) {
|
|||
secret: tt.secret,
|
||||
}
|
||||
}
|
||||
if tt.noSecret {
|
||||
f.hc.Transport = http.DefaultTransport
|
||||
}
|
||||
defer f.close()
|
||||
|
||||
admn, err := f.adClient.Admin.Create(tt.admn).Do()
|
||||
|
|
Reference in a new issue