1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2024-11-28 08:39:03 +02:00

Ensure Authenticated test validates the path where the AuthenticationService hasn't been initialized

This commit is contained in:
Jason O'Broin 2016-05-23 00:09:58 -07:00
parent bc5e20fe93
commit ca7e4dedd4
2 changed files with 11 additions and 8 deletions

View File

@ -1,8 +1,6 @@
package jira
import (
"fmt"
)
import "fmt"
// AuthenticationService handles authentication for the JIRA instance / API.
//

View File

@ -62,11 +62,6 @@ func TestAcquireSessionCookie_Success(t *testing.T) {
fmt.Fprint(w, `{"session":{"name":"JSESSIONID","value":"12345678901234567890"},"loginInfo":{"failedLoginCount":10,"loginCount":127,"lastFailedLoginTime":"2016-03-16T04:22:35.386+0000","previousLoginTime":"2016-03-16T04:22:35.386+0000"}}`)
})
// Test before we've attempted to authenticate
if testClient.Authentication.Authenticated() != false {
t.Error("Expected false, but result was true")
}
res, err := testClient.Authentication.AcquireSessionCookie("foo", "bar")
if err != nil {
t.Errorf("No error expected. Got %s", err)
@ -79,3 +74,13 @@ func TestAcquireSessionCookie_Success(t *testing.T) {
t.Error("Expected true, but result was false")
}
}
func TestAuthenticated_NotInit(t *testing.T) {
// Skip setup() because we don't want a fully setup client
testClient = new(Client)
// Test before we've attempted to authenticate
if testClient.Authentication.Authenticated() != false {
t.Error("Expected false, but result was true")
}
}