1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-02-03 13:11:49 +02:00

go fmt and fixed some typos

This commit is contained in:
Andy Grunwald 2017-05-01 14:59:27 +02:00
parent 426f330664
commit 69e7535b62
5 changed files with 55 additions and 55 deletions

View File

@ -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
@ -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

View File

@ -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")
}
}
@ -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")
}
}
@ -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)

View File

@ -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)
}
}
@ -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
@ -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.
@ -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)
}
}
@ -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"]
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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)
}
}
@ -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")
}
}

View File

@ -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 {
@ -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 {

View File

@ -401,11 +401,11 @@ func TestMetaIssueType_GetMandatoryFields(t *testing.T) {
mandatory, err := m.GetMandatoryFields()
if err != nil {
t.Errorf("Expected nil error, recieved %s", err)
t.Errorf("Expected nil error, received %s", err)
}
if len(mandatory) != 2 {
t.Errorf("Expected 2 recieved %+v", mandatory)
t.Errorf("Expected 2 received %+v", mandatory)
}
}
@ -421,7 +421,7 @@ func TestMetaIssueType_GetMandatoryFields_NonExistentRequiredKey_Fail(t *testing
_, err := m.GetMandatoryFields()
if err == nil {
t.Error("Expected non nil errpr, recieved nil")
t.Error("Expected non nil errpr, received nil")
}
}
@ -437,7 +437,7 @@ func TestMetaIssueType_GetMandatoryFields_NonExistentNameKey_Fail(t *testing.T)
_, err := m.GetMandatoryFields()
if err == nil {
t.Error("Expected non nil errpr, recieved nil")
t.Error("Expected non nil errpr, received nil")
}
}
@ -465,11 +465,11 @@ func TestMetaIssueType_GetAllFields(t *testing.T) {
mandatory, err := m.GetAllFields()
if err != nil {
t.Errorf("Expected nil err, recieved %s", err)
t.Errorf("Expected nil err, received %s", err)
}
if len(mandatory) != 3 {
t.Errorf("Expected 3 recieved %+v", mandatory)
t.Errorf("Expected 3 received %+v", mandatory)
}
}
@ -485,7 +485,7 @@ func TestMetaIssueType_GetAllFields_NonExistingNameKey_Fail(t *testing.T) {
_, err := m.GetAllFields()
if err == nil {
t.Error("Expected non nil error, recieved nil")
t.Error("Expected non nil error, received nil")
}
}
@ -511,7 +511,7 @@ func TestMetaIssueType_CheckCompleteAndAvailable_MandatoryMissing(t *testing.T)
ok, err := m.CheckCompleteAndAvailable(config)
if err == nil {
t.Error("Expected non nil error. Recieved nil")
t.Error("Expected non nil error. Received nil")
}
if ok != false {
@ -538,7 +538,7 @@ func TestMetaIssueType_CheckCompleteAndAvailable_NotAvailable(t *testing.T) {
ok, err := m.CheckCompleteAndAvailable(config)
if err == nil {
t.Error("Expected non nil error. Recieved nil")
t.Error("Expected non nil error. Received nil")
}
if ok != false {
@ -570,7 +570,7 @@ func TestMetaIssueType_CheckCompleteAndAvailable_Success(t *testing.T) {
ok, err := m.CheckCompleteAndAvailable(config)
if err != nil {
t.Errorf("Expected nil error. Recieved %s", err)
t.Errorf("Expected nil error. Received %s", err)
}
if ok != true {
@ -587,7 +587,7 @@ func TestCreateMetaInfo_GetProjectWithName_Success(t *testing.T) {
project := metainfo.GetProjectWithName("SPN")
if project == nil {
t.Errorf("Expected non nil value, recieved nil")
t.Errorf("Expected non nil value, received nil")
}
}
@ -600,7 +600,7 @@ func TestMetaProject_GetIssueTypeWithName_CaseMismatch_Success(t *testing.T) {
issuetype := m.GetIssueTypeWithName("BUG")
if issuetype == nil {
t.Errorf("Expected non nil value, recieved nil")
t.Errorf("Expected non nil value, received nil")
}
}
@ -612,7 +612,7 @@ func TestCreateMetaInfo_GetProjectWithKey_Success(t *testing.T) {
project := metainfo.GetProjectWithKey("SPNKEY")
if project == nil {
t.Errorf("Expected non nil value, recieved nil")
t.Errorf("Expected non nil value, received nil")
}
}
@ -624,6 +624,6 @@ func TestCreateMetaInfo_GetProjectWithKey_NilForNonExistent(t *testing.T) {
project := metainfo.GetProjectWithKey("SPN")
if project != nil {
t.Errorf("Expected nil, recieved value")
t.Errorf("Expected nil, received value")
}
}