From 7d4f41bf04b9efbfc1996686a7939136acf6a9e6 Mon Sep 17 00:00:00 2001 From: Bobby Rullo Date: Tue, 13 Oct 2015 12:34:28 -0700 Subject: [PATCH] integration: check when there's no secret provided --- integration/admin_api_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/integration/admin_api_test.go b/integration/admin_api_test.go index c89b71a4..337eccec 100644 --- a/integration/admin_api_test.go +++ b/integration/admin_api_test.go @@ -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()