Skip to content

Commit

Permalink
go fmt and fixed some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed May 1, 2017
1 parent 426f330 commit 69e7535
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 55 deletions.
8 changes: 4 additions & 4 deletions authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func (s *AuthenticationService) AcquireSessionCookie(username, password string)
}

func (s *AuthenticationService) SetBasicAuth(username, password string) {
s.username = username;
s.password = password;
s.authType = authTypeBasic;
s.username = username
s.password = password
s.authType = authTypeBasic
}

// Authenticated reports if the current Client has authentication details for JIRA
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *AuthenticationService) GetCurrentUser() (*Session, error) {
err = json.Unmarshal(data, &ret)

if err != nil {
return nil, fmt.Errorf("Could not unmarshall recieved user info : %s", err)
return nil, fmt.Errorf("Could not unmarshall received user info : %s", err)
}

return ret, nil
Expand Down
6 changes: 3 additions & 3 deletions authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestAithenticationService_GetUserInfo_AccessForbidden_Fail(t *testing.T) {

_, err := testClient.Authentication.GetCurrentUser()
if err == nil {
t.Errorf("Non nil error expect, recieved nil")
t.Errorf("Non nil error expect, received nil")
}
}

Expand Down Expand Up @@ -204,7 +204,7 @@ func TestAuthenticationService_GetUserInfo_NonOkStatusCode_Fail(t *testing.T) {

_, err := testClient.Authentication.GetCurrentUser()
if err == nil {
t.Errorf("Non nil error expect, recieved nil")
t.Errorf("Non nil error expect, received nil")
}
}

Expand Down Expand Up @@ -259,7 +259,7 @@ func TestAuthenticationService_GetUserInfo_Success(t *testing.T) {

userinfo, err := testClient.Authentication.GetCurrentUser()
if err != nil {
t.Errorf("Nil error expect, recieved %s", err)
t.Errorf("Nil error expect, received %s", err)
}
equal := reflect.DeepEqual(*testUserInfo, *userinfo)

Expand Down
64 changes: 32 additions & 32 deletions issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,14 @@ func TestIssueFields_TestMarshalJSON_PopulateUnknownsSuccess(t *testing.T) {
i := new(IssueFields)
err := json.Unmarshal([]byte(data), i)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

if len(i.Unknowns) != 1 {
t.Errorf("Expected 1 unknown field to be present, recieved %d", len(i.Unknowns))
t.Errorf("Expected 1 unknown field to be present, received %d", len(i.Unknowns))
}
if i.Description != "example bug report" {
t.Errorf("Expected description to be \"%s\", recieved \"%s\"", "example bug report", i.Description)
t.Errorf("Expected description to be \"%s\", received \"%s\"", "example bug report", i.Description)
}

}
Expand All @@ -605,7 +605,7 @@ func TestIssueFields_MarshalJSON_OmitsEmptyFields(t *testing.T) {

rawdata, err := json.Marshal(i)
if err != nil {
t.Errorf("Expected nil err, recieved %s", err)
t.Errorf("Expected nil err, received %s", err)
}

// convert json to map and see if unset keys are there
Expand All @@ -617,7 +617,7 @@ func TestIssueFields_MarshalJSON_OmitsEmptyFields(t *testing.T) {

_, err = issuef.Int("issuetype/avatarId")
if err == nil {
t.Error("Expected non nil error, recieved nil")
t.Error("Expected non nil error, received nil")
}

// verify that the field that should be there, is.
Expand Down Expand Up @@ -647,18 +647,18 @@ func TestIssueFields_MarshalJSON_Success(t *testing.T) {

bytes, err := json.Marshal(i)
if err != nil {
t.Errorf("Expected nil err, recieved %s", err)
t.Errorf("Expected nil err, received %s", err)
}

recieved := new(IssueFields)
received := new(IssueFields)
// the order of json might be different. so unmarshal it again and comapre objects
err = json.Unmarshal(bytes, recieved)
err = json.Unmarshal(bytes, received)
if err != nil {
t.Errorf("Expected nil err, recieved %s", err)
t.Errorf("Expected nil err, received %s", err)
}

if !reflect.DeepEqual(i, recieved) {
t.Errorf("Recieved object different from expected. Expected %+v, recieved %+v", i, recieved)
if !reflect.DeepEqual(i, received) {
t.Errorf("Received object different from expected. Expected %+v, received %+v", i, received)
}
}

Expand Down Expand Up @@ -686,7 +686,7 @@ func TestInitIssueWithMetaAndFields_Success(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

gotSummary, found := issue.Fields.Unknowns["summary"]
Expand All @@ -695,7 +695,7 @@ func TestInitIssueWithMetaAndFields_Success(t *testing.T) {
}

if gotSummary != expectedSummary {
t.Errorf("Expected %s recieved %s", expectedSummary, gotSummary)
t.Errorf("Expected %s received %s", expectedSummary, gotSummary)
}
}

Expand Down Expand Up @@ -725,26 +725,26 @@ func TestInitIssueWithMetaAndFields_ArrayValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

c, isArray := issue.Fields.Unknowns["component"].([]Component)
if isArray == false {
t.Error("Expected array, non array object recieved")
t.Error("Expected array, non array object received")
}

if len(c) != 1 {
t.Errorf("Expected recieved array to be of length 1. Got %d", len(c))
t.Errorf("Expected received array to be of length 1. Got %d", len(c))
}

gotComponent := c[0].Name

if err != nil {
t.Errorf("Expected err to be nil, recieved %s", err)
t.Errorf("Expected err to be nil, received %s", err)
}

if gotComponent != expectedComponent {
t.Errorf("Expected %s recieved %s", expectedComponent, gotComponent)
t.Errorf("Expected %s received %s", expectedComponent, gotComponent)
}
}

Expand Down Expand Up @@ -773,16 +773,16 @@ func TestInitIssueWithMetaAndFields_DateValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

gotCreated, err := issue.Fields.Unknowns.String("created")
if err != nil {
t.Errorf("Expected err to be nil, recieved %s", err)
t.Errorf("Expected err to be nil, received %s", err)
}

if gotCreated != expectedCreated {
t.Errorf("Expected %s recieved %s", expectedCreated, gotCreated)
t.Errorf("Expected %s received %s", expectedCreated, gotCreated)
}
}

Expand Down Expand Up @@ -811,14 +811,14 @@ func TestInitIssueWithMetaAndFields_UserValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

a, _ := issue.Fields.Unknowns.Value("assignee")
gotAssignee := a.(User).Name

if gotAssignee != expectedAssignee {
t.Errorf("Expected %s recieved %s", expectedAssignee, gotAssignee)
t.Errorf("Expected %s received %s", expectedAssignee, gotAssignee)
}
}

Expand Down Expand Up @@ -847,14 +847,14 @@ func TestInitIssueWithMetaAndFields_ProjectValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

a, _ := issue.Fields.Unknowns.Value("project")
gotProject := a.(Project).Name

if gotProject != metaProject.Name {
t.Errorf("Expected %s recieved %s", metaProject.Name, gotProject)
t.Errorf("Expected %s received %s", metaProject.Name, gotProject)
}
}

Expand Down Expand Up @@ -883,14 +883,14 @@ func TestInitIssueWithMetaAndFields_PriorityValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

a, _ := issue.Fields.Unknowns.Value("priority")
gotPriority := a.(Priority).Name

if gotPriority != expectedPriority {
t.Errorf("Expected %s recieved %s", expectedPriority, gotPriority)
t.Errorf("Expected %s received %s", expectedPriority, gotPriority)
}
}

Expand Down Expand Up @@ -919,14 +919,14 @@ func TestInitIssueWithMetaAndFields_SelectList(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

a, _ := issue.Fields.Unknowns.Value("someitem")
gotVal := a.(Option).Value

if gotVal != expectedVal {
t.Errorf("Expected %s recieved %s", expectedVal, gotVal)
t.Errorf("Expected %s received %s", expectedVal, gotVal)
}
}

Expand Down Expand Up @@ -955,14 +955,14 @@ func TestInitIssueWithMetaAndFields_IssuetypeValueType(t *testing.T) {

issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}

a, _ := issue.Fields.Unknowns.Value("issuetype")
gotIssuetype := a.(IssueType).Name

if gotIssuetype != expectedIssuetype {
t.Errorf("Expected %s recieved %s", expectedIssuetype, gotIssuetype)
t.Errorf("Expected %s received %s", expectedIssuetype, gotIssuetype)
}
}

Expand All @@ -989,7 +989,7 @@ func TestInitIssueWithmetaAndFields_FailureWithUnknownValueType(t *testing.T) {
}
_, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
if err == nil {
t.Error("Expected non nil error, recieved nil")
t.Error("Expected non nil error, received nil")
}

}
Expand Down
4 changes: 2 additions & 2 deletions metaissue.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Respo
return meta, resp, nil
}

// GetProjectWithName returns a project with "name" from the meta information recieved. If not found, this returns nil.
// 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.
func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {
for _, m := range m.Projects {
Expand All @@ -72,7 +72,7 @@ func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {
return nil
}

// GetProjectWithKey returns a project with "name" from the meta information recieved. If not found, this returns nil.
// 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.
func (m *CreateMetaInfo) GetProjectWithKey(key string) *MetaProject {
for _, m := range m.Projects {
Expand Down
Loading

0 comments on commit 69e7535

Please sign in to comment.