Пример #1
0
    def test_base(self):
        jobvite_1 = JobvitePositionFactory.create(job_type='aaa')
        workable_1 = WorkablePositionFactory.create(job_type='aaa')
        jobvite_2 = JobvitePositionFactory.create(job_type='bbb')

        job_types = utils.get_all_position_types()
        eq_(job_types, ['aaa', 'bbb'])
Пример #2
0
    def test_orderby(self):
        jobvite_1 = JobvitePositionFactory.create(title='aaa', location='b')
        workable_1 = WorkablePositionFactory.create(title='bbb', location='c')
        jobvite_2 = JobvitePositionFactory.create(title='ccc', location='a')

        positions = utils.get_all_positions(order_by=lambda x: x.location)
        self.assertEqual(positions, [jobvite_2, jobvite_1, workable_1])
Пример #3
0
    def test_filters(self):
        jobvite_1 = JobvitePositionFactory.create(title='aaa')
        jobvite_2 = JobvitePositionFactory.create(title='bbb')
        workable_1 = WorkablePositionFactory.create(title='aaa')

        positions = utils.get_all_positions(filters={'title__contains': 'aaa'})
        eq_(positions, [jobvite_1, workable_1])
Пример #4
0
    def test_orderby(self):
        jobvite_1 = JobvitePositionFactory.create(title='aaa', location='b')
        workable_1 = WorkablePositionFactory.create(title='bbb', location='c')
        jobvite_2 = JobvitePositionFactory.create(title='ccc', location='a')

        positions = utils.get_all_positions(order_by=lambda x: x.location)
        self.assertEqual(positions, [jobvite_2, jobvite_1, workable_1])
Пример #5
0
    def test_base(self):
        JobvitePositionFactory.create(job_type='aaa')
        WorkablePositionFactory.create(job_type='aaa')
        JobvitePositionFactory.create(job_type='bbb')

        job_types = utils.get_all_position_types()
        self.assertEqual(job_types, ['aaa', 'bbb'])
Пример #6
0
    def test_base(self):
        jobvite_1 = JobvitePositionFactory.create(title='Abc')
        jobvite_2 = JobvitePositionFactory.create(title='Def')
        workable_1 = WorkablePositionFactory.create(title='Bcd')

        positions = utils.get_all_positions()
        self.assertEqual(positions, [jobvite_1, workable_1, jobvite_2])
Пример #7
0
    def test_filters(self):
        jobvite_1 = JobvitePositionFactory.create(title='aaa')
        JobvitePositionFactory.create(title='bbb')
        workable_1 = WorkablePositionFactory.create(title='aaa')

        positions = utils.get_all_positions(filters={'title__contains': 'aaa'})
        self.assertEqual(set(positions), set([jobvite_1, workable_1]))
Пример #8
0
    def test_base(self):
        JobvitePositionFactory.create(job_type='aaa')
        WorkablePositionFactory.create(job_type='aaa')
        JobvitePositionFactory.create(job_type='bbb')

        job_types = utils.get_all_position_types()
        self.assertEqual(job_types, ['aaa', 'bbb'])
Пример #9
0
    def test_base(self):
        jobvite_1 = JobvitePositionFactory.create(title='Abc')
        jobvite_2 = JobvitePositionFactory.create(title='Def')
        workable_1 = WorkablePositionFactory.create(title='Bcd')

        positions = utils.get_all_positions()
        self.assertEqual(positions, [jobvite_1, workable_1, jobvite_2])
Пример #10
0
    def test_filters(self):
        jobvite_1 = JobvitePositionFactory.create(title='aaa')
        JobvitePositionFactory.create(title='bbb')
        workable_1 = WorkablePositionFactory.create(title='aaa')

        positions = utils.get_all_positions(filters={'title__contains': 'aaa'})
        self.assertEqual(set(positions), set([jobvite_1, workable_1]))
Пример #11
0
    def test_position_case_sensitive_match(self):
        """
        Validate that a position match is returned from a case-sensitive job id and it doesn't
        raise a multiple records error.
        """
        job_id_1 = 'oflWVfwb'
        job_id_2 = 'oFlWVfwB'
        PositionFactory.create(job_id=job_id_1)
        PositionFactory.create(job_id=job_id_2)

        url = reverse('careers.position',
                      kwargs={
                          'job_id': job_id_1,
                          'source': 'gh'
                      })
        response = self.client.get(url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['position'].job_id, job_id_1)

        url = reverse('careers.position',
                      kwargs={
                          'job_id': job_id_2,
                          'source': 'gh'
                      })
        response = self.client.get(url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['position'].job_id, job_id_2)
Пример #12
0
 def test_open_for_applications(self):
     """
     If there are positions in the Intern category,
     open_for_applications should be True.
     """
     PositionFactory.create(job_type='Intern')
     response, context = self._index()
     ok_(context['open_for_applications'])
Пример #13
0
 def test_open_for_applications(self):
     """
     If there are positions in the Intern category,
     open_for_applications should be True.
     """
     PositionFactory.create(job_type='Intern')
     response, context = self._index()
     ok_(context['open_for_applications'])
Пример #14
0
 def test_closed_for_applications_param(self):
     """
     If the open_for_applications GET parameter is set to 'false',
     open_for_applications should be False, even if there are intern
     positions.
     """
     PositionFactory.create(job_type='Intern')
     response, context = self._index(open_for_applications='false')
     ok_(not context['open_for_applications'])
Пример #15
0
 def test_closed_for_applications_param(self):
     """
     If the open_for_applications GET parameter is set to 'false',
     open_for_applications should be False, even if there are intern
     positions.
     """
     PositionFactory.create(job_type='Intern')
     response, context = self._index(open_for_applications='false')
     ok_(not context['open_for_applications'])
Пример #16
0
 def test_job_removal(self):
     PositionFactory.create(job_id='xxx')
     PositionFactory.create(job_id='yyy')
     jobs_response = {
         'jobs': [
             {
                 'id': 'xxx',
                 'title': 'Web Fox',
                 'absolute_url': 'http://example.com/foo'
             },
         ]
     }
     with patch(REQUESTS) as requests:
         requests.get().json.return_value = jobs_response
         call_command('sync_greenhouse', stdout=StringIO())
     self.assertEqual(Position.objects.all().count(), 1)
     self.assertEqual(Position.objects.all()[0].job_id, 'xxx')
Пример #17
0
 def test_job_removal(self):
     PositionFactory.create(job_id='xxx')
     PositionFactory.create(job_id='yyy')
     jobs_response = {
         'jobs': [
             {
                 'id': 'xxx',
                 'title': 'Web Fox',
                 'absolute_url': 'http://example.com/foo'
             },
         ]
     }
     with patch(REQUESTS) as requests:
         requests.get().json.return_value = jobs_response
         call_command('sync_greenhouse', stdout=StringIO())
     self.assertEqual(Position.objects.all().count(), 1)
     self.assertEqual(Position.objects.all()[0].job_id, 'xxx')
Пример #18
0
    def test_position_case_sensitive_match(self):
        """
        Validate that a position match is returned from a case-sensitive job id and it doesn't
        raise a multiple records error.
        """
        job_id_1 = 'oflWVfwb'
        job_id_2 = 'oFlWVfwB'
        JobvitePositionFactory.create(job_id=job_id_1)
        JobvitePositionFactory.create(job_id=job_id_2)

        url = reverse('careers.position', kwargs={'job_id': job_id_1})
        response = self.client.get(url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['position'].job_id, job_id_1)

        url = reverse('careers.position', kwargs={'job_id': job_id_2})
        response = self.client.get(url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['position'].job_id, job_id_2)
Пример #19
0
    def test_dynamic_position_type_choices(self):
        """
        The choices for the position_type field should be dynamically
        generated from the available values in the database.
        """
        PositionFactory.create(job_type='Foo')
        PositionFactory.create(job_type='Bar')
        PositionFactory.create(job_type='Baz')
        PositionFactory.create(job_type='Foo')
        PositionFactory.create(job_type='Biff')

        form = PositionFilterForm()
        eq_(form.fields['position_type'].choices, [
            ('', 'All Positions'),
            ('Bar', 'Bar'),  # Alphabetical order
            ('Baz', 'Baz'),
            ('Biff', 'Biff'),
            ('Foo', 'Foo'),
        ])
Пример #20
0
    def test_career_feed(self):
        job_id_1 = 'oflWVfwb'
        job_id_2 = 'oFlWVfwB'
        job_1 = PositionFactory.create(job_id=job_id_1)
        job_2 = PositionFactory.create(job_id=job_id_2)

        url = reverse('careers.feed')
        response = self.client.get(url)
        self.assertEqual(response['Content-Type'],
                         'application/rss+xml; charset=utf-8')
        self.assertEqual(response.status_code, 200)

        content = response.content.decode('utf-8')
        self.assertIn(reverse('careers.listings'), content)
        self.assertIn(url, content)

        for job in [job_1, job_2]:
            self.assertIn(job.title, content)
            self.assertIn(job.description, content)
            self.assertIn(job.department, content)
            self.assertIn(job.get_absolute_url(), content)
Пример #21
0
    def test_career_feed(self):
        job_id_1 = 'oflWVfwb'
        job_id_2 = 'oFlWVfwB'
        job_1 = JobvitePositionFactory.create(job_id=job_id_1)
        job_2 = JobvitePositionFactory.create(job_id=job_id_2)

        url = reverse('careers.feed')
        response = self.client.get(url)
        self.assertEqual(response['Content-Type'],
                         'application/rss+xml; charset=utf-8')
        self.assertEqual(response.status_code, 200)

        content = response.content.decode('utf-8')
        self.assertIn(reverse('careers.listings'), content)
        self.assertIn(url, content)

        for job in [job_1, job_2]:
            self.assertIn(job.title, content)
            self.assertIn(job.description, content)
            self.assertIn(job.category.name, content)
            self.assertIn(job.get_absolute_url(), content)
Пример #22
0
 def test_ok(self):
     PositionFactory.create()
     response = self.client.get(reverse('healthz'))
     self.assertEqual(response.status_code, 200)
Пример #23
0
 def setUp(self):
     self.position = PositionFactory.create(
         title='Bowler',
         position_type='Full time',
         location='Los Angeles,Ralphs')