Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
209e1428d8
|
||
|
|
97591d99b5
|
@@ -10,7 +10,7 @@ type UserProfile struct {
|
|||||||
|
|
||||||
func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
|
func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
|
||||||
if usr == nil {
|
if usr == nil {
|
||||||
return nil, fmt.Errof("User is empty")
|
return nil, fmt.Errorf("User is empty")
|
||||||
} else {
|
} else {
|
||||||
usrProfile = new(UserProfile)
|
usrProfile = new(UserProfile)
|
||||||
if len(usr.Password) > 0 {
|
if len(usr.Password) > 0 {
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
func TestInitUserProfile(t *testing.T) {
|
func TestInitUserProfile(t *testing.T) {
|
||||||
usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"}
|
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.NotEmpty(t, profile, "UserProfile is empty")
|
||||||
|
|
||||||
assert.Empty(t, profile.Usr.Password, "Password should be empty")
|
assert.Empty(t, profile.Usr.Password, "Password should be empty")
|
||||||
|
|||||||
Reference in New Issue
Block a user