Skip to content

Commit

Permalink
Improve PATCH method for v2 users (#441)
Browse files Browse the repository at this point in the history
* Migration of tests to BDD scenarios for v2 users

* updated spec

* Regenerate client from commit 8c19b75 of spec repo

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
3 people authored Aug 27, 2020
1 parent a60b394 commit 3b6f255
Show file tree
Hide file tree
Showing 17 changed files with 731 additions and 149 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.2.0",
"regenerated": "2020-08-25 17:11:17.738757",
"spec_repo_commit": "8a33132"
"regenerated": "2020-08-27 13:39:28.011255",
"spec_repo_commit": "8c19b75"
},
"v2": {
"apigentools_version": "1.2.0",
"regenerated": "2020-08-25 17:11:21.966824",
"spec_repo_commit": "8a33132"
"regenerated": "2020-08-27 13:39:33.304105",
"spec_repo_commit": "8c19b75"
}
}
}
8 changes: 7 additions & 1 deletion api/v2/datadog/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,14 @@ paths:
schema:
$ref: '#/components/schemas/UserUpdateRequest'
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponse'
description: OK
"204":
description: No changes
"400":
content:
application/json:
Expand Down
40 changes: 25 additions & 15 deletions api/v2/datadog/api_users.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions api/v2/datadog/docs/UsersApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ Name | Type | Description | Notes
## UpdateUser
> UpdateUser(ctx, userId).Body(body).Execute()
> UserResponse UpdateUser(ctx, userId).Body(body).Execute()
Update a user
Expand Down Expand Up @@ -720,6 +720,8 @@ func main() {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UpdateUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateUser`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UsersApi.UpdateUser`: %v\n", resp)
}
```
Expand All @@ -743,7 +745,7 @@ Name | Type | Description | Notes
### Return type
(empty response body)
[**UserResponse**](UserResponse.md)
### Authorization
Expand Down
4 changes: 2 additions & 2 deletions tests/api/v2/datadog/api_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestUserLifecycle(t *testing.T) {
uur := datadog.NewUserUpdateRequest()
uur.SetData(*uud)
// no response payload
httpresp, err = Client(ctx).UsersApi.UpdateUser(ctx, uid).Body(*uur).Execute()
_, httpresp, err = Client(ctx).UsersApi.UpdateUser(ctx, uid).Body(*uur).Execute()
if err != nil {
t.Fatalf("Error updating User %s: Response %s: %v", uca.GetEmail(), err.(datadog.GenericOpenAPIError).Body(), err)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestUpdateUserErrors(t *testing.T) {
defer finish()
assert := tests.Assert(ctx, t)

httpresp, err := Client(ctx).UsersApi.UpdateUser(ctx, tc.UserID).Body(*tc.Body).Execute()
_, httpresp, err := Client(ctx).UsersApi.UpdateUser(ctx, tc.UserID).Body(*tc.Body).Execute()
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
assert.True(ok)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2020-08-25T12:42:12.33252+02:00
Loading

0 comments on commit 3b6f255

Please sign in to comment.