mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-05-20 20:24:34 -05:00
Merge pull request #34 from smacker/fix_get_project
Fix GetProject method
This commit is contained in:
commit
bc549694e0
@ -5221,7 +5221,7 @@ func (a *DefaultApiService) GetPullRequestsPage(projectKey, repositorySlug strin
|
|||||||
Retrieve the project matching the supplied <strong>projectKey</strong>. <p> The authenticated user must have <strong>PROJECT_VIEW</strong> permission for the specified project to call this resource.
|
Retrieve the project matching the supplied <strong>projectKey</strong>. <p> The authenticated user must have <strong>PROJECT_VIEW</strong> permission for the specified project to call this resource.
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@return */
|
@return */
|
||||||
func (a *DefaultApiService) GetProject(ctx context.Context) (*APIResponse, error) {
|
func (a *DefaultApiService) GetProject(ctx context.Context, projectKey string) (*APIResponse, error) {
|
||||||
var (
|
var (
|
||||||
localVarHTTPMethod = strings.ToUpper("Get")
|
localVarHTTPMethod = strings.ToUpper("Get")
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
@ -5231,6 +5231,7 @@ func (a *DefaultApiService) GetProject(ctx context.Context) (*APIResponse, error
|
|||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}"
|
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
|
||||||
|
|
||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
|
@ -2794,6 +2794,7 @@ func TestDefaultApiService_GetProject(t *testing.T) {
|
|||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
key string
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -2802,14 +2803,14 @@ func TestDefaultApiService_GetProject(t *testing.T) {
|
|||||||
want *APIResponse
|
want *APIResponse
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"networkErrorContextExceeded", fields{client: generateConfigFake()}, args{}, &APIResponse{Message: "Get https://stash.domain.com/rest/api/1.0/projects/%7BprojectKey%7D: context canceled"}, true},
|
{"networkErrorContextExceeded", fields{client: generateConfigFake()}, args{key: "7BprojectKey"}, &APIResponse{Message: "Get https://stash.domain.com/rest/api/1.0/projects/7BprojectKey: context canceled"}, true},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
a := &DefaultApiService{
|
a := &DefaultApiService{
|
||||||
client: tt.fields.client,
|
client: tt.fields.client,
|
||||||
}
|
}
|
||||||
got, err := a.GetProject(tt.args.ctx)
|
got, err := a.GetProject(tt.args.ctx, tt.args.key)
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("DefaultApiService.GetProject() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("DefaultApiService.GetProject() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user