Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1631 from mrf/mrf/1630-projectmember-struct-expir…
Browse files Browse the repository at this point in the history
…es-date

Updates ProjectMember struct with expected format for ExpiresAt field.
  • Loading branch information
svanharmelen authored Jan 19, 2023
2 parents 7d5b490 + 06701b7 commit cec93a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions project_members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -291,19 +292,21 @@ func TestProjectMembersService_EditProjectMember(t *testing.T) {
"web_url": "http://192.168.1.8:3000/root",
"access_level": 30,
"email": "venkatesh.thalluri@example.com",
"expires_at": null,
"expires_at": "2023-10-22T14:13:35Z",
"group_saml_identity": null
}
`)
})

ExpectedExpiry := time.Date(2023, time.October, 22, 14, 13, 35, 0, time.UTC)

want := &ProjectMember{
ID: 1,
Username: "venkatesh_thalluri",
Email: "venkatesh.thalluri@example.com",
Name: "Venkatesh Thalluri",
State: "active",
ExpiresAt: nil,
ExpiresAt: &ExpectedExpiry,
AccessLevel: 30,
WebURL: "http://192.168.1.8:3000/root",
AvatarURL: "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
Expand Down
4 changes: 2 additions & 2 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,15 +1170,15 @@ func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID
// ProjectMember represents a project member.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#list-project-team-members
// https://docs.gitlab.com/ee/api/members.html#list-all-members-of-a-group-or-project
type ProjectMember struct {
ID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Name string `json:"name"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
ExpiresAt *ISOTime `json:"expires_at"`
ExpiresAt *time.Time `json:"expires_at"`
AccessLevel AccessLevelValue `json:"access_level"`
WebURL string `json:"web_url"`
AvatarURL string `json:"avatar_url"`
Expand Down

0 comments on commit cec93a2

Please sign in to comment.