Exemplo n.º 1
0
 def test_update_an_exist_user_should_be_done(self):
     user = UserFactory.create()
     data = UserFactory.attributes()
     resp = self.post('/admin/user/' + str(user.uid) + '/update', data)
     user.reload()
     expect(user.username).to_equal(data.get('username'))
     expect(user.email).to_include(data.get('email'))
Exemplo n.º 2
0
 def test_create_user_should_work(self):
     attr = UserFactory.attributes()
     u = user.create(attr)
     expect(u.username).to_equal(attr.get('username'))
     expect(u.email).to_equal(attr.get('email'))
     expect(u.password).to_equal(md5.new(attr.get('password')).hexdigest())
Exemplo n.º 3
0
 def test_update_not_exist_user_should_response_status_404(self):
     data = UserFactory.attributes()
     resp = self.post('/admin/user/1001/update', data)
     expect(resp.status_int).to_equal(404)
Exemplo n.º 4
0
 def test_update_an_exist_user_should_response_status_200(self):
     user = UserFactory.create()
     data = UserFactory.attributes()
     resp = self.post('/admin/user/' + str(user.uid) + '/update', data)
     expect(resp.status_int).to_equal(200)
Exemplo n.º 5
0
 def test_create_an_exist_username_should_response_duplication_error(self):
     data = UserFactory.attributes()
     user = UserFactory.create(**data)
     resp = self.post('/admin/user/', data)
     expect(resp.status_int).to_equal(400)
     expect(resp).to_include('Duplicated')
Exemplo n.º 6
0
 def test_create_an_user_should_response_correct_data(self):
     data = UserFactory.attributes()
     resp = self.post('/admin/user/', data)
     expect(resp).to_include(data.get('username'))
     expect(resp).to_include(data.get('email'))
Exemplo n.º 7
0
 def test_create_an_user_should_response_status_201(self):
     data = UserFactory.attributes()
     resp = self.post('/admin/user/', data)
     expect(resp.status_int).to_equal(201)