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