mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-02-07 13:31:38 +02:00
Fixed typos
This commit is contained in:
parent
69e7535b62
commit
880a13c107
@ -130,7 +130,7 @@ func (s *AuthenticationService) Logout() error {
|
||||
return fmt.Errorf("The logout was unsuccessful with status %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
// If logout successfull, delete session
|
||||
// If logout successful, delete session
|
||||
s.client.session = nil
|
||||
|
||||
return nil
|
||||
|
6
issue.go
6
issue.go
@ -137,7 +137,7 @@ func (i *IssueFields) MarshalJSON() ([]byte, error) {
|
||||
m := structs.Map(i)
|
||||
unknowns, okay := m["Unknowns"]
|
||||
if okay {
|
||||
// if unknowns present, shift all key value from unkown to a level up
|
||||
// if unknowns present, shift all key value from unknown to a level up
|
||||
for key, value := range unknowns.(tcontainer.MarshalMap) {
|
||||
m[key] = value
|
||||
}
|
||||
@ -297,7 +297,7 @@ type Transition struct {
|
||||
Fields map[string]TransitionField `json:"fields" structs:"fields"`
|
||||
}
|
||||
|
||||
// TransitionField represents the value of one Transistion
|
||||
// TransitionField represents the value of one Transition
|
||||
type TransitionField struct {
|
||||
Required bool `json:"required" structs:"required"`
|
||||
}
|
||||
@ -307,7 +307,7 @@ type CreateTransitionPayload struct {
|
||||
Transition TransitionPayload `json:"transition" structs:"transition"`
|
||||
}
|
||||
|
||||
// TransitionPayload represents the request payload of Transistion calls like DoTransition
|
||||
// TransitionPayload represents the request payload of Transition calls like DoTransition
|
||||
type TransitionPayload struct {
|
||||
ID string `json:"id" structs:"id"`
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ func TestIssueFields_MarshalJSON_Success(t *testing.T) {
|
||||
}
|
||||
|
||||
received := new(IssueFields)
|
||||
// the order of json might be different. so unmarshal it again and comapre objects
|
||||
// the order of json might be different. so unmarshal it again and compare objects
|
||||
err = json.Unmarshal(bytes, received)
|
||||
if err != nil {
|
||||
t.Errorf("Expected nil err, received %s", err)
|
||||
|
40
jira_test.go
40
jira_test.go
@ -132,7 +132,7 @@ func TestCheckResponse(t *testing.T) {
|
||||
func TestClient_NewRequest(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
inURL, outURL := "rest/api/2/issue/", testJIRAInstanceURL+"rest/api/2/issue/"
|
||||
@ -154,7 +154,7 @@ func TestClient_NewRequest(t *testing.T) {
|
||||
func TestClient_NewRawRequest(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
inURL, outURL := "rest/api/2/issue/", testJIRAInstanceURL+"rest/api/2/issue/"
|
||||
@ -187,7 +187,7 @@ func testURLParseError(t *testing.T, err error) {
|
||||
func TestClient_NewRequest_BadURL(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
_, err = c.NewRequest("GET", ":", nil)
|
||||
testURLParseError(t, err)
|
||||
@ -196,7 +196,7 @@ func TestClient_NewRequest_BadURL(t *testing.T) {
|
||||
func TestClient_NewRequest_SessionCookies(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
cookie := &http.Cookie{Name: "testcookie", Value: "testvalue"}
|
||||
@ -208,16 +208,16 @@ func TestClient_NewRequest_SessionCookies(t *testing.T) {
|
||||
req, err := c.NewRequest("GET", inURL, inBody)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
if len(req.Cookies()) != len(c.session.Cookies) {
|
||||
t.Errorf("An error occured. Expected %d cookie(s). Got %d.", len(c.session.Cookies), len(req.Cookies()))
|
||||
t.Errorf("An error occurred. Expected %d cookie(s). Got %d.", len(c.session.Cookies), len(req.Cookies()))
|
||||
}
|
||||
|
||||
for i, v := range req.Cookies() {
|
||||
if v.String() != c.session.Cookies[i].String() {
|
||||
t.Errorf("An error occured. Unexpected cookie. Expected %s, actual %s.", v.String(), c.session.Cookies[i].String())
|
||||
t.Errorf("An error occurred. Unexpected cookie. Expected %s, actual %s.", v.String(), c.session.Cookies[i].String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ func TestClient_NewRequest_SessionCookies(t *testing.T) {
|
||||
func TestClient_NewRequest_BasicAuth(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
c.Authentication.SetBasicAuth("test-user", "test-password")
|
||||
@ -235,12 +235,12 @@ func TestClient_NewRequest_BasicAuth(t *testing.T) {
|
||||
req, err := c.NewRequest("GET", inURL, inBody)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
username, password, ok := req.BasicAuth()
|
||||
if !ok || username != "test-user" || password != "test-password" {
|
||||
t.Errorf("An error occured. Expected basic auth username %s and password %s. Got username %s and password %s.", "test-user", "test-password", username, password)
|
||||
t.Errorf("An error occurred. Expected basic auth username %s and password %s. Got username %s and password %s.", "test-user", "test-password", username, password)
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ func TestClient_NewRequest_BasicAuth(t *testing.T) {
|
||||
func TestClient_NewRequest_EmptyBody(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
req, err := c.NewRequest("GET", "/", nil)
|
||||
if err != nil {
|
||||
@ -265,7 +265,7 @@ func TestClient_NewRequest_EmptyBody(t *testing.T) {
|
||||
func TestClient_NewMultiPartRequest(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
cookie := &http.Cookie{Name: "testcookie", Value: "testvalue"}
|
||||
@ -277,28 +277,28 @@ func TestClient_NewMultiPartRequest(t *testing.T) {
|
||||
req, err := c.NewMultiPartRequest("GET", inURL, inBuf)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
if len(req.Cookies()) != len(c.session.Cookies) {
|
||||
t.Errorf("An error occured. Expected %d cookie(s). Got %d.", len(c.session.Cookies), len(req.Cookies()))
|
||||
t.Errorf("An error occurred. Expected %d cookie(s). Got %d.", len(c.session.Cookies), len(req.Cookies()))
|
||||
}
|
||||
|
||||
for i, v := range req.Cookies() {
|
||||
if v.String() != c.session.Cookies[i].String() {
|
||||
t.Errorf("An error occured. Unexpected cookie. Expected %s, actual %s.", v.String(), c.session.Cookies[i].String())
|
||||
t.Errorf("An error occurred. Unexpected cookie. Expected %s, actual %s.", v.String(), c.session.Cookies[i].String())
|
||||
}
|
||||
}
|
||||
|
||||
if req.Header.Get("X-Atlassian-Token") != "nocheck" {
|
||||
t.Errorf("An error occured. Unexpected X-Atlassian-Token header value. Expected nocheck, actual %s.", req.Header.Get("X-Atlassian-Token"))
|
||||
t.Errorf("An error occurred. Unexpected X-Atlassian-Token header value. Expected nocheck, actual %s.", req.Header.Get("X-Atlassian-Token"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_NewMultiPartRequest_BasicAuth(t *testing.T) {
|
||||
c, err := NewClient(nil, testJIRAInstanceURL)
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
c.Authentication.SetBasicAuth("test-user", "test-password")
|
||||
@ -308,16 +308,16 @@ func TestClient_NewMultiPartRequest_BasicAuth(t *testing.T) {
|
||||
req, err := c.NewMultiPartRequest("GET", inURL, inBuf)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("An error occured. Expected nil. Got %+v.", err)
|
||||
t.Errorf("An error occurred. Expected nil. Got %+v.", err)
|
||||
}
|
||||
|
||||
username, password, ok := req.BasicAuth()
|
||||
if !ok || username != "test-user" || password != "test-password" {
|
||||
t.Errorf("An error occured. Expected basic auth username %s and password %s. Got username %s and password %s.", "test-user", "test-password", username, password)
|
||||
t.Errorf("An error occurred. Expected basic auth username %s and password %s. Got username %s and password %s.", "test-user", "test-password", username, password)
|
||||
}
|
||||
|
||||
if req.Header.Get("X-Atlassian-Token") != "nocheck" {
|
||||
t.Errorf("An error occured. Unexpected X-Atlassian-Token header value. Expected nocheck, actual %s.", req.Header.Get("X-Atlassian-Token"))
|
||||
t.Errorf("An error occurred. Unexpected X-Atlassian-Token header value. Expected nocheck, actual %s.", req.Header.Get("X-Atlassian-Token"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Respo
|
||||
}
|
||||
|
||||
// GetProjectWithName returns a project with "name" from the meta information received. If not found, this returns nil.
|
||||
// The comparision of the name is case insensitive.
|
||||
// The comparison of the name is case insensitive.
|
||||
func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {
|
||||
for _, m := range m.Projects {
|
||||
if strings.ToLower(m.Name) == strings.ToLower(name) {
|
||||
@ -73,7 +73,7 @@ func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {
|
||||
}
|
||||
|
||||
// GetProjectWithKey returns a project with "name" from the meta information received. If not found, this returns nil.
|
||||
// The comparision of the name is case insensitive.
|
||||
// The comparison of the name is case insensitive.
|
||||
func (m *CreateMetaInfo) GetProjectWithKey(key string) *MetaProject {
|
||||
for _, m := range m.Projects {
|
||||
if strings.ToLower(m.Key) == strings.ToLower(key) {
|
||||
@ -84,7 +84,7 @@ func (m *CreateMetaInfo) GetProjectWithKey(key string) *MetaProject {
|
||||
}
|
||||
|
||||
// GetIssueTypeWithName returns an IssueType with name from a given MetaProject. If not found, this returns nil.
|
||||
// The comparision of the name is case insensitive
|
||||
// The comparison of the name is case insensitive
|
||||
func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueType {
|
||||
for _, m := range p.IssueTypes {
|
||||
if strings.ToLower(m.Name) == strings.ToLower(name) {
|
||||
|
@ -100,7 +100,7 @@ func TestIssueService_GetCreateMeta_Success(t *testing.T) {
|
||||
"self": "https://my.jira.com/rest/api/2/component/14152",
|
||||
"id": "14152",
|
||||
"name": "Cloud services",
|
||||
"description": "AWS and similiar services"
|
||||
"description": "AWS and similar services"
|
||||
}, {
|
||||
"self": "https://my.jira.com/rest/api/2/component/14147",
|
||||
"id": "14147",
|
||||
|
Loading…
x
Reference in New Issue
Block a user