Skip to content

Commit

Permalink
Fix "UpdateProfileMapping" doesn't update properties" (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
laura-rodriguez authored Mar 22, 2023
1 parent 206b058 commit c23340e
Show file tree
Hide file tree
Showing 14 changed files with 541 additions and 29 deletions.
2 changes: 1 addition & 1 deletion API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Allows customers to easily access the Okta Management APIs
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 3.0.0
- SDK version: 6.0.6
- SDK version: 6.0.7
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
For more information, please visit [https://developer.okta.com/](https://developer.okta.com/)

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
Running changelog of releases since `3.1.1`

## 6.0.7

- Fix `UpdateProfileMappingAsync doesn't update properties` issue (#618)
- Fix `UpdateUserAsync should allow updating the user type` issue (#615)

## 6.0.6

- Fix ResourceSet API and keep previous interface marked as obsolete for backwards compatibility.
Expand Down
2 changes: 1 addition & 1 deletion docs/ProfileMapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | | [optional] [readonly]
**Properties** | [**Dictionary<string, ProfileMappingProperty>**](ProfileMappingProperty.md) | | [optional] [readonly]
**Properties** | [**Dictionary<string, ProfileMappingProperty>**](ProfileMappingProperty.md) | | [optional]
**Source** | [**ProfileMappingSource**](ProfileMappingSource.md) | | [optional]
**Target** | [**ProfileMappingSource**](ProfileMappingSource.md) | | [optional]
**Links** | **Dictionary<string, Object>** | | [optional] [readonly]
Expand Down
6 changes: 3 additions & 3 deletions docs/UserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3063,7 +3063,7 @@ void (empty response body)

<a name="updateuser"></a>
# **UpdateUser**
> User UpdateUser (string userId, UpdateUserRequest user, bool? strict = null)
> User UpdateUser (string userId, User user, bool? strict = null)
Replace a User

Expand Down Expand Up @@ -3092,7 +3092,7 @@ namespace Example

var apiInstance = new UserApi(config);
var userId = "userId_example"; // string |
var user = new UpdateUserRequest(); // UpdateUserRequest |
var user = new User(); // User |
var strict = true; // bool? | (optional)
try
Expand All @@ -3117,7 +3117,7 @@ namespace Example
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**userId** | **string**| |
**user** | [**UpdateUserRequest**](UpdateUserRequest.md)| |
**user** | [**User**](User.md)| |
**strict** | **bool?**| | [optional]

### Return type
Expand Down
2 changes: 1 addition & 1 deletion openapi3/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"packageName" : "Okta.Sdk",
"outputDir" : "../",
"inputSpec" : "./management.yaml",
"packageVersion" : "6.0.6",
"packageVersion" : "6.0.7",
"packageDescription" : "Official .NET SDK for the Okta API",
"packageTitle" : "Official .NET SDK for the Okta API",
"packageCompany" : "Okta, Inc.",
Expand Down
4 changes: 2 additions & 2 deletions openapi3/management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13930,7 +13930,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUserRequest'
$ref: '#/components/schemas/User'
required: true
responses:
'200':
Expand Down Expand Up @@ -23699,7 +23699,7 @@ components:
type: object
additionalProperties:
$ref: '#/components/schemas/ProfileMappingProperty'
readOnly: true
readOnly: false
source:
$ref: '#/components/schemas/ProfileMappingSource'
target:
Expand Down
4 changes: 0 additions & 4 deletions src/Okta.Sdk.IntegrationTest/Okta.Sdk.IntegrationTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<Compile Remove="UserScenarios.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.6.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
Expand Down
68 changes: 67 additions & 1 deletion src/Okta.Sdk.IntegrationTest/UserScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Polly;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Dynamic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
Expand All @@ -20,6 +22,7 @@ public class UserScenarios
private LinkedObjectApi _linkedObjectApi;
private RoleAssignmentApi _roleAssignmentApi;
private RoleTargetApi _roleTargetApi;
private UserTypeApi _userTypeApi;

public UserScenarios()
{
Expand All @@ -28,6 +31,7 @@ public UserScenarios()
_linkedObjectApi = new LinkedObjectApi();
_roleAssignmentApi = new RoleAssignmentApi();
_roleTargetApi = new RoleTargetApi();
_userTypeApi = new UserTypeApi();
CleanUsers().Wait();
}

Expand Down Expand Up @@ -383,7 +387,7 @@ public async Task UpdateUserProfile(string nickName)
Profile = createdUser.Profile
};

var updatedUser = await _userApi.UpdateUserAsync(createdUser.Id, updateUserRequest);
var updatedUser = await _userApi.PartialUpdateUserAsync(createdUser.Id, updateUserRequest);
updatedUser.Profile.NickName.Should().Be(nickName);
updatedUser.Profile.AdditionalProperties["homeworld"].Should().Be("Planet Earth");

Expand All @@ -399,6 +403,68 @@ public async Task UpdateUserProfile(string nickName)
}
}

[Fact]
public async Task UpdateUserUserType()
{
var guid = Guid.NewGuid();

var createUserRequest = new CreateUserRequest
{
Profile = new UserProfile
{
FirstName = "John",
LastName = nameof(UpdateUserUserType),
Email = $"john-{nameof(UpdateUserUserType)}-dotnet-sdk-{guid}@example.com",
Login = $"john-{nameof(UpdateUserUserType)}-dotnet-sdk-{guid}@example.com",
NickName = $"johny-{nameof(UpdateUserUserType)}-{guid}",
},
Credentials = new UserCredentials
{
Password = new PasswordCredential
{
Value = "Abcd1234"
}
}
};

User createdUser = null;
UserType createdUserType = null;

try
{
createdUser = await _userApi.CreateUserAsync(createUserRequest);

createdUserType = await _userTypeApi.CreateUserTypeAsync(
new UserType
{
Name = $"oktasdk{nameof(UpdateUserUserType)}",
DisplayName = nameof(UpdateUserUserType),
});

createdUser.Type.Id = createdUserType.Id;

var updatedUser = await _userApi.UpdateUserAsync(createdUser.Id, createdUser);

updatedUser = await _userApi.GetUserAsync(createdUser.Id);

updatedUser.Type.Id.Should().Be(createdUserType.Id);
}
finally
{
if (createdUser != null)
{
// Remove the user
await _userApi.DeactivateOrDeleteUserAsync(createdUser.Id);
await _userApi.DeactivateOrDeleteUserAsync(createdUser.Id);
}

if (createdUserType != null)
{
await _userTypeApi.DeleteUserTypeAsync(createdUserType.Id);
}
}
}

[Fact]
public async Task GetResetPasswordUrl()
{
Expand Down
Loading

0 comments on commit c23340e

Please sign in to comment.