fix(project): don't request statistics

This commit is contained in:
Jay McCure 2024-05-02 16:43:28 +10:00
parent 88f63a2c55
commit 55b02cf3e0
No known key found for this signature in database
4 changed files with 17 additions and 18 deletions

View File

@ -7,7 +7,6 @@ var GetProject = func(client *gitlab.Client, projectID interface{}) (*gitlab.Pro
client = apiClient.Lab()
}
opts := &gitlab.GetProjectOptions{
Statistics: gitlab.Ptr(true),
License: gitlab.Ptr(true),
WithCustomAttributes: gitlab.Ptr(true),
}

View File

@ -27,7 +27,7 @@ func TestChangelogGenerate(t *testing.T) {
defer fakeHTTP.Verify(t)
// Mock the project ID
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&statistics=true&with_custom_attributes=true",
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&with_custom_attributes=true",
httpmock.NewStringResponse(http.StatusOK, `{ "id": 37777023 }`))
// Mock the acutal changelog API call
@ -70,7 +70,7 @@ func TestChangelogGenerateWithError(t *testing.T) {
defer fakeHTTP.Verify(t)
// Mock the project ID
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&statistics=true&with_custom_attributes=true",
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&with_custom_attributes=true",
httpmock.NewStringResponse(http.StatusOK, `{ "id": 37777023 }`))
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/37777023/repository/changelog?version=1.0.0",

View File

@ -53,7 +53,7 @@ func TestIssueCreateWhenIssuesDisabled(t *testing.T) {
}
defer fakeHTTP.Verify(t)
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&statistics=true&with_custom_attributes=true",
fakeHTTP.RegisterResponder(http.MethodGet, "/api/v4/projects/OWNER/REPO?license=true&with_custom_attributes=true",
httpmock.NewStringResponse(http.StatusOK, `{
"id": 37777023,
"description": "this is a test description",

View File

@ -75,7 +75,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -123,7 +123,7 @@ func TestProjectView(t *testing.T) {
},
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/test_user%2Ffoo?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/test_user%2Ffoo?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -165,7 +165,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/foo%2Fbar?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/foo%2Fbar?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -208,7 +208,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/group%2Ffoo%2Fbar?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/group%2Ffoo%2Fbar?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -251,7 +251,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -295,7 +295,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -338,7 +338,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -365,7 +365,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -392,7 +392,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -419,7 +419,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -446,7 +446,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -473,7 +473,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -500,7 +500,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.company.org/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,
@ -528,7 +528,7 @@ func TestProjectView(t *testing.T) {
httpMocks: []httpMock{
{
http.MethodGet,
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&statistics=true&with_custom_attributes=true",
"https://gitlab.com/api/v4/projects/OWNER%2FREPO?license=true&with_custom_attributes=true",
http.StatusOK,
`{
"id": 37777023,