Skip to content

Commit

Permalink
[SDK-4769] - add show_as_button to Organization Enabled Connections
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames committed Apr 17, 2024
1 parent e33de1d commit bf74a9a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class EnabledConnection {
private boolean assignMembershipOnLogin;
@JsonProperty("connection_id")
private String connectionId;
@JsonProperty("show_as_button")
private Boolean showAsButton;

public EnabledConnection() {}

Expand Down Expand Up @@ -77,4 +79,20 @@ public String getConnectionId() {
public void setConnectionId(String connectionId) {
this.connectionId = connectionId;
}

/**
* @return the value of the {@code show_as_button} field.
*/
public Boolean getShowAsButton() {
return showAsButton;
}

/**
* Sets the {@code show_as_button} value.
*
* @param showAsButton the value for {@code show_as_button}.
*/
public void setShowAsButton(Boolean showAsButton) {
this.showAsButton = showAsButton;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ public void shouldAddConnection() throws Exception {
EnabledConnection connection = new EnabledConnection();
connection.setAssignMembershipOnLogin(false);
connection.setConnectionId("con_123");
connection.setShowAsButton(true);

Request<EnabledConnection> request = api.organizations().addConnection("org_abc", connection);
assertThat(request, is(notNullValue()));
Expand All @@ -597,9 +598,10 @@ public void shouldAddConnection() throws Exception {
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));

Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body, aMapWithSize(2));
assertThat(body, aMapWithSize(3));
assertThat(body, hasEntry("connection_id", "con_123"));
assertThat(body, hasEntry("assign_membership_on_login", false));
assertThat(body, hasEntry("show_as_button", true));
}

@Test
Expand Down Expand Up @@ -656,6 +658,7 @@ public void shouldThrowOnUpdateConnectionWhenConnectionIsNull() {
public void shouldUpdateOrgConnection() throws Exception {
EnabledConnection connection = new EnabledConnection();
connection.setAssignMembershipOnLogin(true);
connection.setShowAsButton(false);

Request<EnabledConnection> request = api.organizations().updateConnection("org_abc", "con_123", connection);
assertThat(request, is(notNullValue()));
Expand All @@ -669,8 +672,9 @@ public void shouldUpdateOrgConnection() throws Exception {
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));

Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body, aMapWithSize(1));
assertThat(body, aMapWithSize(2));
assertThat(body, hasEntry("assign_membership_on_login", true));
assertThat(body, hasEntry("show_as_button", false));
}

// Organization roles
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/mgmt/organization_connection.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"connection_id": "con_At4BWXhV3lKv82jd",
"assign_membership_on_login": false
"assign_membership_on_login": false,
"show_as_button": true
}
2 changes: 2 additions & 0 deletions src/test/resources/mgmt/organization_connections_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"connection_id": "con_At4BWXhV3lKv82jd",
"assign_membership_on_login": false,
"show_as_button": true,
"connection": {
"name": "google-oauth2",
"strategy": "google-oauth2"
Expand All @@ -10,6 +11,7 @@
{
"connection_id": "con_kai93HmEDCs8ai3d",
"assign_membership_on_login": true,
"show_as_button": true,
"connection": {
"name": "Username-Password-Authentication",
"strategy": "auth0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{
"connection_id": "con_At4BWXhV3lKv82jd",
"assign_membership_on_login": false,
"show_as_button": true,
"connection": {
"name": "google-oauth2",
"strategy": "google-oauth2"
Expand All @@ -11,6 +12,7 @@
{
"connection_id": "con_kai93HmEDCs8ai3d",
"assign_membership_on_login": true,
"show_as_button": true,
"connection": {
"name": "Username-Password-Authentication",
"strategy": "auth0"
Expand Down

0 comments on commit bf74a9a

Please sign in to comment.