test code modify

This commit is contained in:
geek 2017-06-05 21:08:51 +09:00
parent efc069738d
commit c9c1e55724

View File

@ -14,28 +14,43 @@ func TestMemberService_Login(t *testing.T) {
} }
func TestMemberService_Regist(t *testing.T) { func TestMemberService_Regist(t *testing.T) {
m := &MemberService{ //m := &MemberService{
Param: &Member{ // Param: &Member{
// Email:"geek2@loafle.com",
// PwSalt:"qwer5795",
// Company:"Loafle",
// Name:"Geek",
// Phone:"010-4055-6699",
// },
//}
ms := NewMemberService()
m := &Member{
Email:"geek2@loafle.com", Email:"geek2@loafle.com",
PwSalt:"qwer5795", PwSalt:"qwer5795",
Company:"Loafle", Company:"Loafle",
Name:"Geek", Name:"Geek",
Phone:"010-4055-6699", Phone:"010-4055-6699",
},
} }
retMem := ms.Regist(m)
retMem := m.Regist()
t.Log(retMem) t.Log(retMem)
} }
func TestMemberLogin(t *testing.T) { func TestMemberLogin(t *testing.T) {
m := &MemberService{ //m := &MemberService{
Param:&Member{ // Param:&Member{
// Email:"geek@loafle.com",
// PwSalt:"qwer5795",
// },
//}
ms := NewMemberService()
m := &Member{
Email:"geek@loafle.com", Email:"geek@loafle.com",
PwSalt:"qwer5795", PwSalt:"qwer5795",
},
} }
b := m.Login()
b := ms.Login(m)
t.Log("LOGIN RESULT : ", b) t.Log("LOGIN RESULT : ", b)
} }
@ -48,26 +63,23 @@ func TestMemberService_Read(t *testing.T) {
} }
func TestMemberService_ReadByEmail(t *testing.T) { func TestMemberService_ReadByEmail(t *testing.T) {
m := &MemberService{ ms := NewMemberService()
Param:&Member{ m := &Member{
Email:"geek@loafle.com", Email:"geek@loafle.com",
},
} }
mm := ms.getMemberMap(m)
mm := m.getMemberMap()
rr := proxy.InvokeDB(TARGET_DAO, "findByEmail", mm) rr := proxy.InvokeDB(TARGET_DAO, "findByEmail", mm)
log.Println(rr) log.Println(rr)
} }
func TestMemberUpdate(t *testing.T) { func TestMemberUpdate(t *testing.T) {
m := &MemberService{
Param:&Member{ ms := NewMemberService()
m := &Member{
Id: "11", Id: "11",
Email:"keeg@loafle.com", Email:"keeg@loafle.com",
},
} }
mm := ms.getMemberMap(m)
mm := m.getMemberMap()
rr := proxy.InvokeDB(TARGET_DAO, "update", mm) rr := proxy.InvokeDB(TARGET_DAO, "update", mm)
log.Println(rr) log.Println(rr)
} }
@ -76,7 +88,7 @@ func TestComvertJson(t *testing.T) {
m := make(map[string]string) m := make(map[string]string)
m["email"] = "geek@loafle.com" m["email"] = "geek@loafle.com"
m["password"] = "qwer5795" m["pwSalt"] = "qwer5795"
ss := NewMemberService() ss := NewMemberService()
paramStr, err := json.Marshal(m) paramStr, err := json.Marshal(m)
@ -84,9 +96,10 @@ func TestComvertJson(t *testing.T) {
glog.Fatal("Json Marshal Failed : ", err.Error()) glog.Fatal("Json Marshal Failed : ", err.Error())
} }
// service converting // service converting
err = json.Unmarshal(paramStr, ss.Param) mem := ss.GetModel()
err = json.Unmarshal(paramStr, mem)
if err != nil { if err != nil {
glog.Fatal("Json Unmarshal Failed : ", err.Error()) glog.Fatal("Json Unmarshal Failed : ", err.Error())
} }
fmt.Println(ss.Param.Email) fmt.Println(mem.(*Member).Email)
} }