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

improvement: [PLA-10528] add sms pending and double-opt-in opt-out types to user profile #81

Merged
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
5 changes: 3 additions & 2 deletions src/main/com/sailthru/client/params/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ public ApiAction getApiCall() {

public enum OptOutType {
OPT_OUT_TYPE_STOP("opt-out"),
OPT_OUT_TYPE_START("opt-in");

OPT_OUT_TYPE_START("opt-in"),
OPT_OUT_TYPE_PENDING("pending"),
OPT_OUT_TYPE_DOUBLE_OPT_IN("double-opt-in");
public final String optOutTypeStr;

OptOutType(String optOutTypeStr) {
Expand Down
52 changes: 50 additions & 2 deletions src/test/com/sailthru/client/params/UserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,70 @@ public void testSetOptoutSmsStatus() {
assertEquals(expected, result);
}

public void testSetSmsMarketingStatus() {
public void testSetSmsMarketingStatusTypeStart() {
user.setSmsMarketingStatus(User.OptOutType.OPT_OUT_TYPE_START);

String expected = "{\"sms_marketing_status\":\"opt-in\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsTransactionalStatus() {
public void testSetSmsTransactionalStatusTypeStart() {
user.setSmsTransactionalStatus(User.OptOutType.OPT_OUT_TYPE_START);

String expected = "{\"sms_transactional_status\":\"opt-in\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsMarketingStatusTypeStop() {
user.setSmsMarketingStatus(User.OptOutType.OPT_OUT_TYPE_STOP);

String expected = "{\"sms_marketing_status\":\"opt-out\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsTransactionalStatusTypeStop() {
user.setSmsTransactionalStatus(User.OptOutType.OPT_OUT_TYPE_STOP);

String expected = "{\"sms_transactional_status\":\"opt-out\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsMarketingStatusTypePending() {
user.setSmsMarketingStatus(User.OptOutType.OPT_OUT_TYPE_PENDING);

String expected = "{\"sms_marketing_status\":\"pending\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsTransactionalStatusTypePending() {
user.setSmsTransactionalStatus(User.OptOutType.OPT_OUT_TYPE_PENDING);

String expected = "{\"sms_transactional_status\":\"pending\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsMarketingStatusTypeDoubleOptIn() {
user.setSmsMarketingStatus(User.OptOutType.OPT_OUT_TYPE_DOUBLE_OPT_IN);

String expected = "{\"sms_marketing_status\":\"double-opt-in\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetSmsTransactionalStatusTypeDoubleOptIn() {
user.setSmsTransactionalStatus(User.OptOutType.OPT_OUT_TYPE_DOUBLE_OPT_IN);

String expected = "{\"sms_transactional_status\":\"double-opt-in\"}";
String result = gson.toJson(user);
assertEquals(expected, result);
}

public void testSetLogin() {
Map<String, Object> login = new HashMap<String, Object>();
login.put("ip", "123.456.789.0");
Expand Down