mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-04-04 17:00:12 -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.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return */
|
||||
func (a *DefaultApiService) GetProject(ctx context.Context) (*APIResponse, error) {
|
||||
func (a *DefaultApiService) GetProject(ctx context.Context, projectKey string) (*APIResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
@ -5231,6 +5231,7 @@ func (a *DefaultApiService) GetProject(ctx context.Context) (*APIResponse, error
|
||||
|
||||
// create path and map variables
|
||||
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)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
@ -2794,6 +2794,7 @@ func TestDefaultApiService_GetProject(t *testing.T) {
|
||||
}
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
key string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@ -2802,14 +2803,14 @@ func TestDefaultApiService_GetProject(t *testing.T) {
|
||||
want *APIResponse
|
||||
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 {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
a := &DefaultApiService{
|
||||
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 {
|
||||
t.Errorf("DefaultApiService.GetProject() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user