Skip to content

Commit 23ea602

Browse files
committed
Fix broken test after adding additional privacy control.
1 parent 9d62892 commit 23ea602

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎wise-api/src/main/java/com/wisemapping/rest/model/RestUserRegistration.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ public Account build() {
4949
}
5050

5151
public static RestUserRegistration create(String email, String password, String firstname, String lastname) {
52+
return create(email, password, firstname, lastname, false);
53+
}
54+
55+
public static RestUserRegistration create(String email, String password, String firstname, String lastname,
56+
boolean acceptedTerms) {
5257
final RestUserRegistration result = new RestUserRegistration();
5358
result.email = email;
5459
result.password = password;
5560
result.firstname = firstname;
5661
result.lastname = lastname;
62+
result.acceptedTerms = acceptedTerms;
5763
return result;
5864
}
5965

‎wise-api/src/test/java/com/wisemapping/test/rest/RestUserControllerTest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void shouldRegisterNewUserSuccessfully() {
164164
@DisplayName("Should reject registration with disposable email")
165165
void shouldRejectRegistrationWithDisposableEmail() {
166166
RestUserRegistration userWithDisposableEmail = RestUserRegistration.create(
167-
"test@10minutemail.com", "password123", "Test", "User"
167+
"test@10minutemail.com", "password123", "Test", "User", true
168168
);
169169
HttpHeaders headers = new HttpHeaders();
170170
headers.setContentType(MediaType.APPLICATION_JSON);
@@ -202,7 +202,7 @@ void shouldRejectRegistrationWithDuplicateEmail() {
202202

203203
// Then try to create duplicate with same email
204204
RestUserRegistration duplicateUser = RestUserRegistration.create(
205-
firstUser.getEmail(), "password123", "Duplicate", "User"
205+
firstUser.getEmail(), "password123", "Duplicate", "User", true
206206
);
207207
HttpEntity<RestUserRegistration> request2 = new HttpEntity<>(duplicateUser, headers);
208208

@@ -244,7 +244,7 @@ void shouldValidateUserRegistrationInput(RestUserRegistration invalidUser, Strin
244244
private static Stream<Arguments> invalidRegistrationData() {
245245
return Stream.of(
246246
Arguments.of(
247-
RestUserRegistration.create("invalid-email", "password123", "Test", "User"),
247+
RestUserRegistration.create("invalid-email", "password123", "Test", "User", true),
248248
"Invalid email address"
249249
)
250250
);
@@ -295,7 +295,7 @@ void shouldHandleEmptyRequestBody() {
295295
@DisplayName("Should test user registration endpoint exists")
296296
void registerUserEndpointExists() {
297297
RestUserRegistration testUser = RestUserRegistration.create(
298-
"endpoint.test@example.org", "validpassword123", "Valid", "User"
298+
"endpoint.test@example.org", "validpassword123", "Valid", "User", true
299299
);
300300
HttpHeaders headers = new HttpHeaders();
301301
headers.setContentType(MediaType.APPLICATION_JSON);

‎wise-api/src/test/java/com/wisemapping/test/rest/TestDataManager.java‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public RestUser createTestUser() {
6464

6565
public RestUserRegistration createTestUserRegistration() {
6666
String email = generateUniqueEmail();
67-
RestUserRegistration registration = RestUserRegistration.create(email, "testPassword123", "Test", "User");
67+
RestUserRegistration registration = RestUserRegistration.create(
68+
email, "testPassword123", "Test", "User", true
69+
);
6870

6971
createdUserEmails.add(email);
7072
return registration;
@@ -97,7 +99,9 @@ public List<RestUserRegistration> generateMultipleUsers(int count) {
9799
List<RestUserRegistration> users = new ArrayList<>();
98100
for (int i = 0; i < count; i++) {
99101
String email = generateUniqueEmail();
100-
RestUserRegistration user = RestUserRegistration.create(email, "testPassword123", "Test" + i, "User" + i);
102+
RestUserRegistration user = RestUserRegistration.create(
103+
email, "testPassword123", "Test" + i, "User" + i, true
104+
);
101105

102106
users.add(user);
103107
createdUserEmails.add(email);
@@ -138,7 +142,7 @@ public RestUserRegistration createInvalidUserRegistration(String field, Object v
138142
break;
139143
}
140144

141-
return RestUserRegistration.create(email, password, firstname, lastname);
145+
return RestUserRegistration.create(email, password, firstname, lastname, true);
142146
}
143147

144148
public void cleanupTestData() {
@@ -154,4 +158,4 @@ public void cleanupTestData() {
154158
}
155159
createdUserEmails.clear();
156160
}
157-
}
161+
}

0 commit comments

Comments
 (0)