Merge branch 'dev' into hohoTT-dev

This commit is contained in:
hohoTT
2015-09-02 15:48:31 +08:00
9 changed files with 19 additions and 32 deletions

View File

@@ -123,22 +123,13 @@ class UserChangePasswordAPITest(APITestCase):
user = User.objects.create(username="test")
user.set_password("aaabbb")
user.save()
self.client.login(username="test",password="aaabbb")
def test_error_old_password(self):
data = {"username": "test", "old_password": "aaaccc", "new_password": "aaaddd"}
data = {"old_password": "aaaccc", "new_password": "aaaddd"}
response = self.client.post(self.url, data=data)
self.assertEqual(response.data, {"code": 1, "data": u"密码不正确,请重新修改!"})
def test_invalid_data_format(self):
data = {"old_password": "aaa", "new_password": "aaaddd"}
response = self.client.post(self.url, data=data)
self.assertEqual(response.data["code"], 1)
def test_username_does_not_exist(self):
data = {"username": "test1", "old_password": "aaabbb", "new_password": "aaaddd"}
response = self.client.post(self.url, data=data)
self.assertEqual(response.data["code"], 1)
def test_success_change_password(self):
data = {"username": "test", "old_password": "aaabbb", "new_password": "aaaccc"}
response = self.client.post(self.url, data=data)