예제 #1
0
func TestNewRole(t *testing.T) {
	roleList, err := NewRole().FindAll()
	for _, tmpUser := range roleList {
		t.logger(tmpUser.Roleid)
		t.logger("===")
	}
	if err != nil {
		t.Fatal(err)
	}
}
예제 #2
0
func testInsert(t *testing.T) {
	userLogin := NewUserLogin()
	userData := `{"uid":"1111","username":"******","email":"*****@*****.**","passwd":"123456"}`
	json.Unmarshal([]byte(userData), userLogin)
	// err := userLogin.Find()
	affectedNum, err := userLogin.Insert()
	if err != nil {
		t.Fatal(err)
	}
	t.logger(affectedNum)
}
예제 #3
0
func TestNewUserLogin(t *testing.T) {
	user := NewUser()
	userList, err := user.FindAll()
	for _, tmpUser := range userList {
		t.logger(tmpUser.Name)
		t.logger("===")
	}
	if err == nil {
		t.Fatal(err)
	}
}
예제 #4
0
func TestFindUsers(t *testing.T) {
	userList, err := FindUsers()
	if err != nil && len(userList) == 0 {
		t.Fatal(err)
	}
	t.logger(len(userList))
	for k, tmpUser := range userList {
		t.logger(k, tmpUser)
		t.logger("===")
	}
}