Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-4769] - add show_as_button to Organization Enabled Connections #631

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading