MCPcopy Index your code
hub / github.com/dearcode/candy / TestUpdateUserPassword

Function TestUpdateUserPassword

client/candy_test.go:164–199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestUpdateUserPassword(t *testing.T) {
165 for name := range userNames {
166 //first need login
167 id, err := client.Login(name, passwd[name])
168 if err != nil {
169 t.Fatalf("Login error:%v", err)
170 }
171
172 //random passwd
173 newPasswd := fmt.Sprintf("newpwd%v", time.Now().Unix())
174
175 id, err = client.UpdateUserPassword(name, newPasswd)
176 if err != nil {
177 t.Fatalf("UpdateUserPassword error:%v", err)
178 }
179
180 t.Logf("UpdateUserPassword success, userID:%d userName:%v", id, name)
181
182 //Logout
183 err = client.Logout()
184 if err != nil {
185 t.Fatalf("user Logout error:%v", err)
186 }
187
188 //Login
189 id, err = client.Login(name, newPasswd)
190 if err != nil {
191 t.Fatalf("use new password login err:%v", err)
192 }
193 t.Logf("test logout success")
194
195 passwd[name] = newPasswd
196
197 t.Logf("UpdateUserPassword success, userID:%d userName:%v, newPasswd:%s", id, name, newPasswd)
198 }
199}
200
201func TestFindUser(t *testing.T) {
202 for name := range userNames {

Callers

nothing calls this directly

Calls 3

LoginMethod · 0.65
UpdateUserPasswordMethod · 0.65
LogoutMethod · 0.65

Tested by

no test coverage detected