Skip to content

Commit d61e88a

Browse files
authored
Fixed POST/PATCH connection endpoints (#710)
1 parent 81f64d6 commit d61e88a

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public class Connection {
3535
@JsonProperty("realms")
3636
private List<String> realms;
3737
@JsonProperty("show_as_button")
38-
private boolean showAsButton;
38+
private Boolean showAsButton;
3939
@JsonProperty("is_domain_connection")
40-
private boolean isDomainConnection;
40+
private Boolean isDomainConnection;
4141

4242
public Connection() {
4343
}
@@ -193,7 +193,8 @@ public void setRealms(List<String> realms) {
193193
*
194194
* @return the show as button flag.
195195
*/
196-
public boolean isShowAsButton() {
196+
@JsonProperty("show_as_button")
197+
public Boolean isShowAsButton() {
197198
return showAsButton;
198199
}
199200

@@ -202,23 +203,26 @@ public boolean isShowAsButton() {
202203
*
203204
* @param showAsButton the show as button flag to set.
204205
*/
205-
public void setShowAsButton(boolean showAsButton) {
206+
@JsonProperty("show_as_button")
207+
public void setShowAsButton(Boolean showAsButton) {
206208
this.showAsButton = showAsButton;
207209
}
208210

209211
/**
210212
* Getter for the domain connection flag.
211213
* @return the domain connection flag.
212214
*/
213-
public boolean isDomainConnection() {
215+
@JsonProperty("is_domain_connection")
216+
public Boolean isDomainConnection() {
214217
return isDomainConnection;
215218
}
216219

217220
/**
218221
* Setter for the domain connection flag.
219222
* @param domainConnection the domain connection flag to set.
220223
*/
221-
public void setDomainConnection(boolean domainConnection) {
222-
isDomainConnection = domainConnection;
224+
@JsonProperty("is_domain_connection")
225+
public void setDomainConnection(Boolean domainConnection) {
226+
this.isDomainConnection = domainConnection;
223227
}
224228
}

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(2));
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)