Esempio n. 1
0
 def test_registration(self):
     """
     Test the user registration
     """
     with self.client:
         response = PostHTTP.register_success(self.client);
         data = json.loads(response.data.decode())
         self.assertTrue(data['status'] == 'success')
         self.assertTrue(response.content_type=='application/json')
         self.assertEqual(response.status_code,status.HTTP_200_OK)
Esempio n. 2
0
 def test_registered_with_already_registered_user(self):
     """ Test registration with already registered email"""
     DatabasePrepare.create_new_user()
     with self.client:
         response = PostHTTP.register_success(self.client)
         data = json.loads(response.data.decode())
         self.assertTrue(data['status'] == 'fail')
         self.assertTrue(
             data['message'] == 'User already exists. Please Log in.')
         self.assertTrue(response.content_type == 'application/json')
         self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)