Skip to content

Commit bb9d64d

Browse files
committed
Fixed POST/PATCH connection endpoints
1 parent 8959fc1 commit bb9d64d

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/main/java/com/auth0/json/mgmt/connections/Connection.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public void setShowAsButton(boolean showAsButton) {
210210
* Getter for the domain connection flag.
211211
* @return the domain connection flag.
212212
*/
213+
@JsonProperty("is_domain_connection")
213214
public boolean isDomainConnection() {
214215
return isDomainConnection;
215216
}
@@ -218,7 +219,8 @@ public boolean isDomainConnection() {
218219
* Setter for the domain connection flag.
219220
* @param domainConnection the domain connection flag to set.
220221
*/
222+
@JsonProperty("is_domain_connection")
221223
public void setDomainConnection(boolean domainConnection) {
222-
isDomainConnection = domainConnection;
224+
this.isDomainConnection = domainConnection;
223225
}
224226
}

src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ public void shouldThrowOnCreateConnectionWithNullData() {
176176

177177
@Test
178178
public void shouldCreateConnection() throws Exception {
179-
Request<Connection> request = api.connections().create(new Connection("my-connection", "auth0"));
179+
Connection createConnection = new Connection("my-connection", "auth0");
180+
createConnection.setDomainConnection(true);
181+
createConnection.setShowAsButton(true);
182+
Request<Connection> request = api.connections().create(createConnection);
180183
assertThat(request, is(notNullValue()));
181184

182185
server.jsonResponse(MGMT_CONNECTION, 200);
@@ -188,7 +191,7 @@ public void shouldCreateConnection() throws Exception {
188191
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
189192

190193
Map<String, Object> body = bodyFromRequest(recordedRequest);
191-
assertThat(body.size(), is(5));
194+
assertThat(body.size(), is(4));
192195
assertThat(body, hasEntry("name", "my-connection"));
193196
assertThat(body, hasEntry("strategy", "auth0"));
194197

@@ -244,7 +247,7 @@ public void shouldUpdateConnection() throws Exception {
244247
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
245248

246249
Map<String, Object> body = bodyFromRequest(recordedRequest);
247-
assertThat(body.size(), is(5));
250+
assertThat(body.size(), is(4));
248251
assertThat(body, hasEntry("name", "my-connection"));
249252
assertThat(body, hasEntry("strategy", "auth0"));
250253

src/test/resources/mgmt/connection.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"ScKKdrpyUwfkhOQP6KXItH32INgZf7Rb"
99
],
1010
"metadata": {
11-
"key": "value"
12-
}
13-
}
11+
"key": "value"
12+
},
13+
"is_domain_connection": true,
14+
"show_as_button": true
15+
}

0 commit comments

Comments
 (0)