Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d074d3d7
|
||
|
|
209e1428d8
|
||
|
|
97591d99b5
|
@@ -4,13 +4,14 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// TODO: Replace Usr with all the fields from User, except Password and other sensitive fields
|
||||
type UserProfile struct {
|
||||
Usr *User `json:"user"`
|
||||
}
|
||||
|
||||
func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
|
||||
if usr == nil {
|
||||
return nil, fmt.Errof("User is empty")
|
||||
return nil, fmt.Errorf("User is empty")
|
||||
} else {
|
||||
usrProfile = new(UserProfile)
|
||||
if len(usr.Password) > 0 {
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
func TestInitUserProfile(t *testing.T) {
|
||||
usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"}
|
||||
|
||||
profile, done := InitUserProfile(&usr)
|
||||
profile, err := InitUserProfile(&usr)
|
||||
|
||||
assert.Equal(t, done, true, "Error")
|
||||
assert.NoError(t, err, "Error %v", err)
|
||||
assert.NotEmpty(t, profile, "UserProfile is empty")
|
||||
|
||||
assert.Empty(t, profile.Usr.Password, "Password should be empty")
|
||||
|
||||
Reference in New Issue
Block a user