fix(testing): return organization name in failure messages

pull/11484/head
Jade McGough 2019-01-22 19:12:51 -08:00
parent 6ebea1bc23
commit 7840e5e6b4
3 changed files with 15 additions and 5 deletions

View File

@ -105,10 +105,15 @@ func (s *Service) FindOrganization(ctx context.Context, filter platform.Organiza
}
}
if n < 1 {
msg := errOrganizationNotFound
if filter.Name != nil {
msg = fmt.Sprintf("organization name \"%s\" not found", *filter.Name)
}
return nil, &platform.Error{
Code: platform.ENotFound,
Op: op,
Msg: errOrganizationNotFound,
Msg: msg,
}
}
@ -146,10 +151,15 @@ func (s *Service) FindOrganizations(ctx context.Context, filter platform.Organiz
}
if len(orgs) == 0 {
msg := errOrganizationNotFound
if filter.Name != nil {
msg = fmt.Sprintf("organization name \"%s\" not found", *filter.Name)
}
return orgs, 0, &platform.Error{
Code: platform.ENotFound,
Op: op,
Msg: errOrganizationNotFound,
Msg: msg,
}
}

View File

@ -367,7 +367,7 @@ func CreateBucket(
buckets: []*platform.Bucket{},
err: &platform.Error{
Code: platform.ENotFound,
Msg: "organization not found",
Msg: "organization name \"org1\" not found",
Op: platform.OpCreateBucket,
},
},

View File

@ -465,7 +465,7 @@ func FindOrganizations(
err: &platform.Error{
Code: platform.ENotFound,
Op: platform.OpFindOrganizations,
Msg: "organization not found",
Msg: "organization name \"na\" not found",
},
},
},
@ -652,7 +652,7 @@ func FindOrganization(
err: &platform.Error{
Code: platform.ENotFound,
Op: platform.OpFindOrganization,
Msg: "organization not found",
Msg: "organization name \"abc\" not found",
},
},
},