release 0.1 #30

Manually merged
noemi3 merged 150 commits from release/0.1 into master 2020-01-18 14:59:02 +00:00
6 changed files with 186 additions and 7 deletions
Showing only changes of commit eaded60e46 - Show all commits

View File

@ -0,0 +1,21 @@
package wekan.wrapper.entity;
public class Password {
@Override
public String toString() {
return "Password{" +
"bcrypt='" + bcrypt + '\'' +
'}';
}
public String getBcrypt() {
return bcrypt;
}
public void setBcrypt(String bcrypt) {
this.bcrypt = bcrypt;
}
private String bcrypt;
}

View File

@ -0,0 +1,30 @@
package wekan.wrapper.entity;
import java.util.List;
/**
* Keeps track of access through the LoginToken list
* LoginToken contains the hash code of the access token
* and the date of that access
*
*/
public class Resume {
public List<LoginToken> getLoginTokens() {
return loginTokens;
}
public void setLoginTokens(List<LoginToken> loginTokens) {
this.loginTokens = loginTokens;
}
@Override
public String toString() {
return "Resume{" +
"loginTokens=" + loginTokens +
'}';
}
private List<LoginToken> loginTokens;
}

View File

@ -0,0 +1,41 @@
package wekan.wrapper.entity;
public class Service {
public Email getEmail() {
return email;
}
public void setEmail(Email email) {
this.email = email;
}
public Resume getResume() {
return resume;
}
public void setResume(Resume resume) {
this.resume = resume;
}
public Password getPassword() {
return password;
}
public void setPassword(Password password) {
this.password = password;
}
@Override
public String toString() {
return "Service{" +
"email=" + email +
", resume=" + resume +
", password=" + password +
'}';
}
private Email email;
private Resume resume;
private Password password;
}

View File

@ -95,6 +95,14 @@ public class User {
this.authenticationMethod = authenticationMethod;
}
public Service getServices() {
return services;
}
public void setServices(Service services) {
this.services = services;
}
@Override
public String toString() {
return "User{" +
@ -109,9 +117,11 @@ public class User {
", createdThroughApi=" + createdThroughApi +
", loginDisabled=" + loginDisabled +
", authenticationMethod='" + authenticationMethod + '\'' +
", services='" + services + '\'' +
'}';
}
@SerializedName("_id")
private String id;
private String username;
@ -119,8 +129,7 @@ public class User {
private Date createdAt;
private Date modifiedAt;
private UserProfile profile;
//Class Service doesn't implemented in API
//private Service service;
private Service services;
private String heartbeat;
private boolean isAdmin;
private boolean createdThroughApi;

View File

@ -0,0 +1,43 @@
package wekan.wrapper.entity;
import java.util.Date;
public class VerificationToken {
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Date getWhen() {
return when;
}
public void setWhen(Date when) {
this.when = when;
}
@Override
public String toString() {
return "VerificationToken{" +
"token='" + token + '\'' +
", address='" + address + '\'' +
", when=" + when +
'}';
}
private String token;
private String address;
private Date when;
}

View File

@ -8,6 +8,7 @@ import org.junit.Test;
import static org.junit.Assert.*;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import wekan.wrapper.entity.Service;
import wekan.wrapper.entity.User;
import wekan.wrapper.entity.UserEmail;
import wekan.wrapper.entity.UserProfile;
@ -82,17 +83,25 @@ public class UserServiceTest {
assert user != null;
List<UserEmail> userEmail = user.getEmails();
UserProfile userProfile = user.getProfile();
Service ser = user.getServices();
assertEquals("jPdkf3a9bmfZWx3GR", user.getId());
assertEquals("umberto", user.getUsername());
assertEquals("password", user.getAuthenticationMethod());
assertTrue(user.isAdmin());
assertEquals("2019-10-14T18:14:38.249Z", user.getCreatedAt());
assertEquals("Mon Oct 14 20:14:38 CEST 2019", user.getCreatedAt().toString());
assertFalse(userEmail.isEmpty());
assertEquals("umbertof993@gmail.com", userEmail.get(0).getEmail());
assertEquals("my@email.com", userEmail.get(0).getEmail());
assertFalse(userEmail.get(0).isVerified());
assertEquals("board-view-swimlanes", userProfile.getBoardView());
assertEquals("BOARD_VIEW_SWIMLANES", userProfile.getBoardView().toString());
assertEquals("zo82BZYxFTNBpb7jX", userProfile.getCardTemplatesSwimlaneId());
assertEquals("-modifiedAt", userProfile.getListSortBy());
assertEquals("_MODIFIEDAT", userProfile.getListSortBy().toString());
assertEquals(1, ser.getEmail().getVerificationTokens().size());
assertEquals("my@email.com",
ser.getEmail().getVerificationTokens().get(0).getAddress());
assertEquals("$2a$10$CRZrpT4x.VpG2FdJxR3rN.9m0NbQb0OPsSPBDAZukggxrskMtWA8.",
ser.getPassword().getBcrypt());
assertEquals(2, ser.getResume().getLoginTokens().size());
assertEquals("CY/PWeDa3fAkl+k94+GWzCtpB5nPcVxLzzzjXs4kI3A=", ser.getResume().getLoginTokens().get(0).getHashedToken());
} catch (IOException e) {
e.printStackTrace();
@ -105,7 +114,7 @@ public class UserServiceTest {
private static final String user1 = "{" +
"\"_id\":\"jPdkf3a9bmfZWx3GR\"," +
"\"username\":\"umberto\"," +
"\"emails\":[{\"address\":\"umbertof993@gmail.com\",\"verified\":false}]," +
"\"emails\":[{\"address\":\"my@email.com\",\"verified\":false}]," +
"\"authenticationMethod\":\"password\"," +
"\"isAdmin\":\"true\"," +
"\"loginDisabled\":\"true\"," +
@ -114,5 +123,31 @@ public class UserServiceTest {
"\"boardTemplatesSwimlaneId\":\"j6ZuPbwaN9nsCDxyS\",\"listSortBy\":\"-modifiedAt\"}," +
"\"createdAt\":\"2019-10-14T18:14:38.249Z\","+
"\"modifiedAt\":\"2019-11-09T17:55:36.976Z\"," +
"\"services\":{\n" +
" \"password\":{\n" +
" \"bcrypt\":\"$2a$10$CRZrpT4x.VpG2FdJxR3rN.9m0NbQb0OPsSPBDAZukggxrskMtWA8.\"\n" +
" },\n" +
" \"email\":{\n" +
" \"verificationTokens\":[\n" +
" {\n" +
" \"token\":\"8rzwpq_So2PVYHVSfrcc5f5QZnuV2wEtu7QRQGwOJx8\",\n" +
" \"address\":\"my@email.com\",\n" +
" \"when\":\"2017-09-13T06:45:53.157Z\"\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"resume\":{\n" +
" \"loginTokens\":[\n" +
" {\n" +
" \"when\":\"2017-09-13T06:45:53.265Z\",\n" +
" \"hashedToken\":\"CY/PWeDa3fAkl+k94+GWzCtpB5nPcVxLzzzjXs4kI3A=\"\n" +
" },\n" +
" {\n" +
" \"when\":\"2017-09-16T06:06:19.741Z\",\n" +
" \"hashedToken\":\"74MQNXfsgjkItx/gpgPb29Y0MSNAvBrsnSGQmr4YGvQ=\"\n" +
" }\n" +
" ]\n" +
" }\n" +
"}\n" +
"}";
}