예제 #1
0
파일: test_views.py 프로젝트: wfhio/tramcar
    def setUp(self):
        password = '******'
        user = User(username='******')
        user.set_password(password)
        user.full_clean()
        user.save()
        ut = UserToken(user=user, tokens=1)
        ut.full_clean()
        ut.save()
        company = Company(name='Tramcar', url='http://www.tramcar.org',
                          site_id=1, user_id=user.id)
        company.full_clean()
        company.save()
        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()
        self.job = Job(title='Software Developer',
                       description='Test description',
                       application_info='test', category_id=category.id,
                       company_id=company.id, site_id=1, user_id=user.id,
                       city='Toronto', state='Ontario',
                       email='*****@*****.**')
        self.job.full_clean()
        self.job.save()

        self.client.post(
          '/login/',
          {'username': user.username, 'password': password}
        )
예제 #2
0
 def setUp(self):
     self.user = User(username='******')
     self.user.set_password('password')
     self.user.full_clean()
     self.user.save()
     self.company = Company(name='Tramcar', site_id=1, user_id=self.user.id,
                            url='http://www.tramcar.org')
     self.company.full_clean()
     self.company.save()
     self.category = Category(name='Software Development', site_id=1)
     self.category.full_clean()
     self.category.save()
예제 #3
0
class CompanyMethodTests(TestCase):
    def setUp(self):
        self.user = User(username='******')
        self.user.set_password('password')
        self.user.full_clean()
        self.user.save()
        self.company = Company(name='Tramcar',
                               site_id=1,
                               user_id=self.user.id,
                               url='http://www.tramcar.org')
        self.company.full_clean()
        self.company.save()
        self.category = Category(name='Software Development', site_id=1)
        self.category.full_clean()
        self.category.save()

    def test_active_jobs(self):
        job = Job(title='Software Developer',
                  description='Test description',
                  application_info='test',
                  category_id=self.category.id,
                  company_id=self.company.id,
                  site_id=1,
                  user_id=self.user.id,
                  city='Toronto',
                  state='Ontario',
                  email='*****@*****.**')
        job.full_clean()
        job.save()
        self.assertEqual(len(self.company.active_jobs()), 0)
        job.activate()
        self.assertEqual(len(self.company.active_jobs()), 1)

    def test_paid_jobs(self):
        job = Job(title='Software Developer',
                  description='Test description',
                  application_info='test',
                  category_id=self.category.id,
                  company_id=self.company.id,
                  site_id=1,
                  user_id=self.user.id,
                  city='Toronto',
                  state='Ontario',
                  email='*****@*****.**')
        job.full_clean()
        job.save()
        self.assertEqual(len(self.company.paid_jobs()), 0)
        job.activate()
        self.assertEqual(len(self.company.paid_jobs()), 1)
예제 #4
0
 def setUp(self):
     user = User(username='******')
     user.set_password('password')
     user.full_clean()
     user.save()
     company = Company(name='Tramcar', url='http://www.tramcar.org',
                       site_id=1, user_id=user.id)
     company.full_clean()
     company.save()
     category = Category(name='Software Development', site_id=1)
     category.full_clean()
     category.save()
     job = Job(title='Software Developer',
               description='Test description',
               application_info='test', category_id=category.id,
               company_id=company.id, site_id=1, user_id=user.id,
               city='Toronto', state='Ontario',
               email='*****@*****.**')
     job.paid_at = job.created_at
     job.full_clean()
     job.save()
예제 #5
0
 def setUp(self):
     self.user = User(username='******')
     self.user.set_password('password')
     self.user.full_clean()
     self.user.save()
     self.company = Company(name='Tramcar', site_id=1, user_id=self.user.id,
                            url='http://www.tramcar.org')
     self.company.full_clean()
     self.company.save()
     self.category = Category(name='Software Development', site_id=1)
     self.category.full_clean()
     self.category.save()
예제 #6
0
    def setUp(self):
        password = '******'
        user = User(username='******')
        user.set_password(password)
        user.full_clean()
        user.save()
        ut = UserToken(user=user, tokens=1)
        ut.full_clean()
        ut.save()
        company = Company(name='Tramcar',
                          url='http://www.tramcar.org',
                          site_id=1,
                          user_id=user.id)
        company.full_clean()
        company.save()
        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()
        self.job = Job(title='Software Developer',
                       description='Test description',
                       application_info='test',
                       category_id=category.id,
                       company_id=company.id,
                       site_id=1,
                       user_id=user.id,
                       city='Toronto',
                       state='Ontario',
                       email='*****@*****.**')
        self.job.full_clean()
        self.job.save()

        self.client.post('/login/', {
            'username': user.username,
            'password': password
        })
예제 #7
0
 def setUp(self):
     user = User(username='******')
     user.set_password('password')
     user.full_clean()
     user.save()
     company = Company(name='Tramcar',
                       url='http://www.tramcar.org',
                       site_id=1,
                       user_id=user.id)
     company.full_clean()
     company.save()
     category = Category(name='Software Development', site_id=1)
     category.full_clean()
     category.save()
     self.job = Job(title='Software Developer',
                    description='Test description',
                    application_info='test',
                    category_id=category.id,
                    company_id=company.id,
                    site_id=1,
                    user_id=user.id,
                    city='Toronto',
                    state='Ontario',
                    email='*****@*****.**')
     self.job.full_clean()
     self.job.save()
     self.job.activate()
예제 #8
0
class CompanyMethodTests(TestCase):
    def setUp(self):
        self.user = User(username='******')
        self.user.set_password('password')
        self.user.full_clean()
        self.user.save()
        self.company = Company(name='Tramcar', site_id=1, user_id=self.user.id,
                               url='http://www.tramcar.org')
        self.company.full_clean()
        self.company.save()
        self.category = Category(name='Software Development', site_id=1)
        self.category.full_clean()
        self.category.save()

    def test_active_jobs(self):
        job = Job(title='Software Developer',
                  description='Test description',
                  application_info='test', category_id=self.category.id,
                  company_id=self.company.id, site_id=1, user_id=self.user.id,
                  city='Toronto', state='Ontario',
                  email='*****@*****.**')
        job.full_clean()
        job.save()
        self.assertEqual(len(self.company.active_jobs()), 0)
        job.activate()
        self.assertEqual(len(self.company.active_jobs()), 1)

    def test_paid_jobs(self):
        job = Job(title='Software Developer',
                  description='Test description',
                  application_info='test', category_id=self.category.id,
                  company_id=self.company.id, site_id=1, user_id=self.user.id,
                  city='Toronto', state='Ontario',
                  email='*****@*****.**')
        job.full_clean()
        job.save()
        self.assertEqual(len(self.company.paid_jobs()), 0)
        job.activate()
        self.assertEqual(len(self.company.paid_jobs()), 1)
예제 #9
0
파일: test_views.py 프로젝트: wfhio/tramcar
    def setUp(self):
        password = '******'
        admin = User(username='******')
        admin.is_staff = True
        admin.set_password(password)
        admin.full_clean()
        admin.save()

        self.other = User(username='******')
        self.other.set_password(password)
        self.other.full_clean()
        self.other.save()

        country = Country(name='Canada')
        country.full_clean()
        country.save()

        company = Company(name='Tramcar', site_id=1, user_id=self.other.id,
                          url='http://www.tramcar.org')
        company.full_clean()
        company.save()

        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()

        self.job = Job(title='Software Developer',
                       description='Test description',
                       application_info='test', category_id=category.id,
                       company_id=company.id, site_id=1, user_id=self.other.id,
                       city='Toronto', state='Ontario',
                       email='*****@*****.**')
        self.job.full_clean()
        self.job.save()

        self.client.post(
          '/login/',
          {'username': admin.username, 'password': password}
        )
예제 #10
0
    def setUp(self):
        password = '******'
        admin = User(username='******')
        admin.is_staff = True
        admin.set_password(password)
        admin.full_clean()
        admin.save()

        self.other = User(username='******')
        self.other.set_password(password)
        self.other.full_clean()
        self.other.save()

        country = Country(name='Canada')
        country.full_clean()
        country.save()

        company = Company(name='Tramcar',
                          site_id=1,
                          user_id=self.other.id,
                          url='http://www.tramcar.org')
        company.full_clean()
        company.save()

        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()

        self.job = Job(title='Software Developer',
                       description='Test description',
                       application_info='test',
                       category_id=category.id,
                       company_id=company.id,
                       site_id=1,
                       user_id=self.other.id,
                       city='Toronto',
                       state='Ontario',
                       email='*****@*****.**')
        self.job.full_clean()
        self.job.save()

        self.client.post('/login/', {
            'username': admin.username,
            'password': password
        })
예제 #11
0
class CategoryViewTests(TestCase):
    def setUp(self):
        self.category = Category(name='Software Development', site_id=1)
        self.category.full_clean()
        self.category.save()

    def test_index_view(self):
        response = self.client.get(reverse('categories_index'))
        self.assertEqual(response.status_code, 200)

    def test_show_view(self):
        response = self.client.get(self.category.get_absolute_url())
        self.assertEqual(response.status_code, 200)

    def test_show_view_without_slug_redirects_to_slug(self):
        response = self.client.get(
            reverse('categories_show', args=(self.category.id, )))
        self.assertRedirects(response,
                             self.category.get_absolute_url(),
                             status_code=301)
예제 #12
0
파일: test_views.py 프로젝트: wfhio/tramcar
class CategoryViewTests(TestCase):
    def setUp(self):
        self.category = Category(name='Software Development', site_id=1)
        self.category.full_clean()
        self.category.save()

    def test_index_view(self):
        response = self.client.get(reverse('categories_index'))
        self.assertEqual(response.status_code, 200)

    def test_show_view(self):
        response = self.client.get(self.category.get_absolute_url())
        self.assertEqual(response.status_code, 200)

    def test_show_view_without_slug_redirects_to_slug(self):
        response = self.client.get(
                       reverse('categories_show', args=(self.category.id,))
                   )
        self.assertRedirects(
            response, self.category.get_absolute_url(), status_code=301
        )
예제 #13
0
    def setUp(self):
        password = '******'
        owner = User(username='******')
        owner.set_password(password)
        owner.full_clean()
        owner.save()

        other = User(username='******')
        other.set_password(password)
        other.full_clean()
        other.save()

        country = Country(name='Canada')
        country.full_clean()
        country.save()

        company = Company(name='Tramcar',
                          site_id=1,
                          user_id=owner.id,
                          url='http://www.tramcar.org')
        company.full_clean()
        company.save()

        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()

        self.job1 = Job(title='Software Developer',
                        description='Test description',
                        application_info='test',
                        category_id=category.id,
                        company_id=company.id,
                        site_id=1,
                        user_id=owner.id,
                        city='Toronto',
                        state='Ontario',
                        email='*****@*****.**')
        self.job1.full_clean()
        self.job1.save()
        self.job1.activate()

        self.job2 = Job(title='QA Engineer',
                        description='Test description',
                        application_info='test',
                        category_id=category.id,
                        company_id=company.id,
                        site_id=1,
                        user_id=other.id,
                        city='Toronto',
                        state='Ontario',
                        email='*****@*****.**')
        self.job2.full_clean()
        self.job2.save()
        self.job2.activate()

        self.job3 = Job(title='DevOps Engineer',
                        description='Test description',
                        application_info='test',
                        category_id=category.id,
                        company_id=company.id,
                        site_id=1,
                        user_id=other.id,
                        city='Toronto',
                        state='Ontario',
                        email='*****@*****.**')
        self.job3.full_clean()
        self.job3.save()

        self.job4 = Job(title='Growth Hacker',
                        description='Test description',
                        application_info='test',
                        category_id=category.id,
                        company_id=company.id,
                        site_id=1,
                        user_id=owner.id,
                        city='Toronto',
                        state='Ontario',
                        email='*****@*****.**')
        self.job4.full_clean()
        self.job4.save()

        self.client.post('/login/', {
            'username': owner.username,
            'password': password
        })
예제 #14
0
 def setUp(self):
     self.category = Category(name='Software Development', site_id=1)
     self.category.full_clean()
     self.category.save()
예제 #15
0
파일: test_views.py 프로젝트: wfhio/tramcar
    def setUp(self):
        password = '******'
        owner = User(username='******')
        owner.set_password(password)
        owner.full_clean()
        owner.save()

        other = User(username='******')
        other.set_password(password)
        other.full_clean()
        other.save()

        country = Country(name='Canada')
        country.full_clean()
        country.save()

        company = Company(name='Tramcar', site_id=1, user_id=owner.id,
                          url='http://www.tramcar.org')
        company.full_clean()
        company.save()

        category = Category(name='Software Development', site_id=1)
        category.full_clean()
        category.save()

        self.job1 = Job(title='Software Developer',
                        description='Test description',
                        application_info='test', category_id=category.id,
                        company_id=company.id, site_id=1, user_id=owner.id,
                        city='Toronto', state='Ontario',
                        email='*****@*****.**')
        self.job1.full_clean()
        self.job1.save()
        self.job1.activate()

        self.job2 = Job(title='QA Engineer',
                        description='Test description',
                        application_info='test', category_id=category.id,
                        company_id=company.id, site_id=1, user_id=other.id,
                        city='Toronto', state='Ontario',
                        email='*****@*****.**')
        self.job2.full_clean()
        self.job2.save()
        self.job2.activate()

        self.job3 = Job(title='DevOps Engineer',
                        description='Test description',
                        application_info='test', category_id=category.id,
                        company_id=company.id, site_id=1, user_id=other.id,
                        city='Toronto', state='Ontario',
                        email='*****@*****.**')
        self.job3.full_clean()
        self.job3.save()

        self.job4 = Job(title='Growth Hacker',
                        description='Test description',
                        application_info='test', category_id=category.id,
                        company_id=company.id, site_id=1, user_id=owner.id,
                        city='Toronto', state='Ontario',
                        email='*****@*****.**')
        self.job4.full_clean()
        self.job4.save()

        self.client.post(
          '/login/',
          {'username': owner.username, 'password': password}
        )
예제 #16
0
파일: test_views.py 프로젝트: wfhio/tramcar
 def setUp(self):
     self.category = Category(name='Software Development', site_id=1)
     self.category.full_clean()
     self.category.save()