Skip to content

Commit 44b7647

Browse files
authored
fix: User key replaced by Team key in GroupsTeam structure (#124)
1 parent 07bc3a7 commit 44b7647

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

crowdin/model/teams.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,5 @@ type TeamsGetResponse struct {
224224
// GroupsTeam represents a group team.
225225
type GroupsTeam struct {
226226
ID int `json:"id"`
227-
User *Team `json:"user"`
227+
Team *Team `json:"team"`
228228
}

crowdin/teams_test.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ func TestGroupsTeamsService_List(t *testing.T) {
696696
"data": [
697697
{
698698
"data": {
699-
"id": 27,
700-
"user": {
699+
"id": 27,
700+
"team": {
701701
"id": 2,
702702
"name": "Translators Team",
703703
"totalMembers": 8,
@@ -725,7 +725,7 @@ func TestGroupsTeamsService_List(t *testing.T) {
725725
{
726726
Data: &model.GroupsTeam{
727727
ID: 27,
728-
User: &model.Team{
728+
Team: &model.Team{
729729
ID: 2,
730730
Name: "Translators Team",
731731
TotalMembers: 8,
@@ -737,7 +737,7 @@ func TestGroupsTeamsService_List(t *testing.T) {
737737
},
738738
}
739739

740-
if teams[0].User.Name != want[0].Data.User.Name {
740+
if teams[0].Team.Name != want[0].Data.Team.Name {
741741
t.Errorf("Managers.List returned ID %v, want %v", teams[0].ID, want[0].Data.ID)
742742
}
743743

@@ -770,13 +770,13 @@ func TestGroupTeamsService_Get(t *testing.T) {
770770
fmt.Fprint(w, `{
771771
"data": {
772772
"id": 27,
773-
"user": {
774-
"id": 2,
775-
"name": "Translators Team",
776-
"totalMembers": 8,
777-
"webUrl": "https://example.crowdin.com/u/teams/1",
778-
"createdAt": "2019-09-23T09:04:29+00:00",
779-
"updatedAt": "2019-09-23T09:04:29+00:00"
773+
"team": {
774+
"id": 2,
775+
"name": "Translators Team",
776+
"totalMembers": 8,
777+
"webUrl": "https://example.crowdin.com/u/teams/1",
778+
"createdAt": "2019-09-23T09:04:29+00:00",
779+
"updatedAt": "2019-09-23T09:04:29+00:00"
780780
}
781781
}
782782
}`)
@@ -790,7 +790,7 @@ func TestGroupTeamsService_Get(t *testing.T) {
790790
want := &model.TeamsGetResponse{
791791
Data: &model.GroupsTeam{
792792
ID: 18,
793-
User: &model.Team{
793+
Team: &model.Team{
794794
ID: 2,
795795
Name: "Translators Team",
796796
TotalMembers: 8,
@@ -801,7 +801,7 @@ func TestGroupTeamsService_Get(t *testing.T) {
801801
},
802802
}
803803

804-
if teams.User.ID != want.Data.User.ID {
804+
if teams.Team.ID != want.Data.Team.ID {
805805
t.Errorf("Managers.Get returned %+v, want %+v", teams, want)
806806
}
807807
}
@@ -817,18 +817,18 @@ func TestGroupTeamsService_Edit(t *testing.T) {
817817
fmt.Fprint(w, `{
818818
"data": [
819819
{
820-
"data": {
821-
"id": 2,
822-
"user": {
823-
"id": 18,
824-
"name": "Translators Team",
825-
"totalMembers": 8,
826-
"webUrl": "https://example.crowdin.com/u/teams/1",
827-
"createdAt": "2019-09-23T09:04:29+00:00",
828-
"updatedAt": "2019-09-23T09:04:29+00:00"
820+
"data": {
821+
"id": 2,
822+
"team": {
823+
"id": 18,
824+
"name": "Translators Team",
825+
"totalMembers": 8,
826+
"webUrl": "https://example.crowdin.com/u/teams/1",
827+
"createdAt": "2019-09-23T09:04:29+00:00",
828+
"updatedAt": "2019-09-23T09:04:29+00:00"
829+
}
829830
}
830831
}
831-
}
832832
]
833833
}`)
834834
})
@@ -849,8 +849,8 @@ func TestGroupTeamsService_Edit(t *testing.T) {
849849

850850
want := 18
851851

852-
if teams[0].User.ID != want {
853-
t.Errorf("Managers.Edit returned %+v, want %+v", teams[0].User.ID, want)
852+
if teams[0].Team.ID != want {
853+
t.Errorf("Managers.Edit returned %+v, want %+v", teams[0].Team.ID, want)
854854
}
855855
}
856856

0 commit comments

Comments
 (0)