Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cfccc2722
|
||
|
|
801a314421
|
||
|
|
9565259dc1
|
||
|
|
f05a513926
|
@@ -1,11 +1,5 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
type UserProfile struct {
|
||||
Usr *User `json:"user"`
|
||||
@@ -15,6 +9,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) {
|
||||
if usr == nil {
|
||||
return nil, false
|
||||
} else {
|
||||
usrProfile = new(UserProfile)
|
||||
if len(usr.Password) > 0 {
|
||||
var newUsr User
|
||||
newUsr = *usr
|
||||
@@ -29,12 +24,3 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitUserProfile(t *testing.T) {
|
||||
usr := User{}
|
||||
usr.Username = "Bob"
|
||||
usr.PhoneNumber = "+12224572351"
|
||||
usr.Password = "TheNight!"
|
||||
profile, done := InitUserProfile(&usr)
|
||||
assert.Equal(t, done, true, "Error")
|
||||
assert.NotEmpty(t, profile, "UserProfile is empty")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestInitUserProfile(t *testing.T) {
|
||||
usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"}
|
||||
|
||||
profile, done := InitUserProfile(&usr)
|
||||
|
||||
assert.Equal(t, done, true, "Error")
|
||||
assert.NotEmpty(t, profile, "UserProfile is empty")
|
||||
}
|
||||
Reference in New Issue
Block a user