mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-09-16 09:06:19 +02:00
Moved Authentication() test into AuthenticationService, and add test case to validate it operates correctly
This commit is contained in:
@@ -36,6 +36,10 @@ func TestAcquireSessionCookie_Fail(t *testing.T) {
|
||||
if res == true {
|
||||
t.Error("Expected error, but result was true")
|
||||
}
|
||||
|
||||
if testClient.Authentication.Authenticated() != false {
|
||||
t.Error("Expected false, but result was true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAcquireSessionCookie_Success(t *testing.T) {
|
||||
@@ -58,6 +62,11 @@ 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)
|
||||
@@ -65,4 +74,8 @@ func TestAcquireSessionCookie_Success(t *testing.T) {
|
||||
if res == false {
|
||||
t.Error("Expected result was true. Got false")
|
||||
}
|
||||
|
||||
if testClient.Authentication.Authenticated() != true {
|
||||
t.Error("Expected true, but result was false")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user