예제 #1
0
 def setUp(self):
     CompanyModel.objects.create(name="test1",
                                 sector="abc",
                                 website="abc",
                                 about="abc")
     self.job_structure = {
         "recruiter": 1,
         "company": "1",
         "job_title": "SR Manager",
         "job_type": "FT",
         "job_qualification": "MBA Passout",
         "job_location": "Mumbai",
         "salary_range_min": None,
         "salary_range_max": None,
         "work_experience_min": None,
         "work_experience_max": None,
         "no_of_opening": None,
         "job_description": "Manager"
     }
     self.user_structure = {
         "first_name": "Aayush",
         "last_name": "Sinha",
         "email_id": "*****@*****.**",
         "phone_number": "9876543210",
         "password": "******",
         "type": "recruiter",
         "company": "1",  # Company ID
         "pan": "123"
     }
     User.createUser(self.user_structure)
     Job.add_job(self.job_structure)
예제 #2
0
def register(request):

    if request.method == 'POST':
        try:
            print(request.body.decode())
            user_structure = json.loads(request.body.decode())

            res = User.createUser(user_structure)

            if res == USER_ADDED_SUCCESS:

                token = create_token(user_structure["email_id"],
                                     user_structure["type"])

                return HttpResponse(json.dumps({
                    "message": "user successfully added",
                    "token": token
                }),
                                    content_type='application/json')

            else:
                print(res)
                return HttpResponseBadRequest(json.dumps({"message": res}),
                                              content_type='application/json')

        except Exception as e:
            print(str(e))
            return HttpResponseServerError(json.dumps({'message': str(e)}),
                                           content_type='application/json')

    else:
        return HttpResponseBadRequest(json.dumps(
            {"message": "only post method"}),
                                      content_type='application/json')
예제 #3
0
 def test_recruiter(self):
     res = User.createUser(self.user_structure)
     self.assertEqual(res, USER_ADDED_SUCCESS)
     user_object = User(1, self.user_structure["type"])
     self.user_structure["cv"] = 'abc'
     self.user_structure["user_id"] = 1
     del self.user_structure["password"]
     res = user_object.update_details(self.user_structure)
     self.assertEqual(res, USER_UPDATE_SUCCESS)
예제 #4
0
 def test_recruiter(self):
     res = User.createUser(self.user_structure)
     self.assertEqual(res, USER_ADDED_SUCCESS)
예제 #5
0
 def test_candidate(self):
     res = User.createUser(self.user_structure_candidate)
     self.assertEqual(res, USER_ADDED_SUCCESS)