mirror of https://github.com/apache/jclouds.git
Fixes tenantId when using the keystone admin extension
This commit is contained in:
parent
ab25fc7259
commit
02b79106c3
|
@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
public class CreateUserOptions implements MapBinder{
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
|
||||
private String tenant;
|
||||
private String password;
|
||||
private String email;
|
||||
|
@ -75,7 +75,7 @@ public class CreateUserOptions implements MapBinder{
|
|||
|
||||
static class ServerRequest {
|
||||
final String name;
|
||||
String tenant;
|
||||
String tenantId;
|
||||
String password;
|
||||
String email;
|
||||
boolean enabled;
|
||||
|
@ -97,7 +97,7 @@ public class CreateUserOptions implements MapBinder{
|
|||
if (password != null)
|
||||
user.password = password;
|
||||
if (tenant != null)
|
||||
user.tenant = tenant;
|
||||
user.tenantId = tenant;
|
||||
user.enabled = enabled;
|
||||
|
||||
return bindToRequest(request, ImmutableMap.of("user", user));
|
||||
|
|
|
@ -48,7 +48,8 @@ public class UserAdminApiMockTest extends BaseOpenStackMockTest<KeystoneApi> {
|
|||
try {
|
||||
KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
|
||||
UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
|
||||
CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true);
|
||||
CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true)
|
||||
.tenant("12345");
|
||||
User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions);
|
||||
|
||||
assertNotNull(testUser);
|
||||
|
@ -61,7 +62,7 @@ public class UserAdminApiMockTest extends BaseOpenStackMockTest<KeystoneApi> {
|
|||
assertEquals(createUserRequest.getRequestLine(), "POST /users HTTP/1.1");
|
||||
assertEquals(
|
||||
new String(createUserRequest.getBody()),
|
||||
"{\"user\":{\"name\":\"jqsmith\",\"password\":\"jclouds-password\",\"email\":\"john.smith@example.org\",\"enabled\":true}}");
|
||||
"{\"user\":{\"name\":\"jqsmith\",\"tenantId\":\"12345\",\"password\":\"jclouds-password\",\"email\":\"john.smith@example.org\",\"enabled\":true}}");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue