Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Remove django_workable.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed May 18, 2016
1 parent bc0b376 commit fc5e3bc
Show file tree
Hide file tree
Showing 17 changed files with 7 additions and 373 deletions.
3 changes: 0 additions & 3 deletions careers/careers/tests/test_forms.py
@@ -1,7 +1,6 @@
from careers.base.tests import TestCase
from careers.careers.forms import PositionFilterForm
from careers.careers.tests import PositionFactory as JobvitePositionFactory
from careers.django_workable.tests import PositionFactory as WorkablePositionFactory


class PositionFilterFormTests(TestCase):
Expand All @@ -14,13 +13,11 @@ def test_dynamic_position_type_choices(self):
JobvitePositionFactory.create(job_type='Bar')
JobvitePositionFactory.create(job_type='Baz')
JobvitePositionFactory.create(job_type='Foo')
WorkablePositionFactory.create(job_type='Biff')

form = PositionFilterForm()
self.assertEqual(form.fields['position_type'].choices, [
('', 'All Positions'),
('Bar', 'Bar'), # Alphabetical order
('Baz', 'Baz'),
('Biff', 'Biff'),
('Foo', 'Foo'),
])
15 changes: 4 additions & 11 deletions careers/careers/tests/test_utils.py
Expand Up @@ -2,50 +2,43 @@
from careers.careers import utils
from careers.careers.tests import (CategoryFactory as JobviteCategoryFactory,
PositionFactory as JobvitePositionFactory)
from careers.django_workable.tests import (CategoryFactory as WorkableCategoryFactory,
PositionFactory as WorkablePositionFactory)


class GetAllPositionsTests(TestCase):
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])
self.assertEqual(positions, [jobvite_1, jobvite_2])

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]))
self.assertEqual(set(positions), set([jobvite_1]))

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])
self.assertEqual(positions, [jobvite_2, jobvite_1])


class GetAllCategoriesTests(TestCase):
def test_base(self):
jobvite_1 = JobviteCategoryFactory.create(name='ccc')
workable_1 = WorkableCategoryFactory.create(name='bbb')
jobvite_2 = JobviteCategoryFactory.create(name='aaa')

categories = utils.get_all_categories()
self.assertEqual(categories, [jobvite_2.name, workable_1.name, jobvite_1.name])
self.assertEqual(categories, [jobvite_2.name, jobvite_1.name])


class GetAllPositionTypesTests(TestCase):
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()
Expand Down
12 changes: 0 additions & 12 deletions careers/careers/tests/test_views.py
Expand Up @@ -2,7 +2,6 @@

from careers.base.tests import TestCase
from careers.careers.tests import PositionFactory as JobvitePositionFactory
from careers.django_workable.tests import PositionFactory as WorkablePositionFactory


class PositionTests(TestCase):
Expand All @@ -26,14 +25,3 @@ def test_position_case_sensitive_match(self):
response = self.client.get(url, follow=True)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context_data['position'].job_id, job_id_2)


class WorkablePositionDetailViewTests(TestCase):
def test_base(self):
position_1 = WorkablePositionFactory.create(title='bbb')
position_2 = WorkablePositionFactory.create(category=position_1.category, title='aaa')
status = self.client.get(
reverse('careers.workable_position', kwargs={'shortcode': position_1.shortcode}),
follow=True)
self.assertEqual(status.context_data['positions'], [position_2, position_1])
self.assertEqual(status.context_data['position'], position_1)
2 changes: 0 additions & 2 deletions careers/careers/urls.py
Expand Up @@ -4,8 +4,6 @@
from .feeds import LatestPositionsFeed

urlpatterns = [
url(r'^position/wa/(?P<shortcode>[\w]+)$', views.WorkablePositionDetailView.as_view(),
name='careers.workable_position'),
url(r'^position/(?P<job_id>[\w]+)$', views.JobvitePositionDetailView.as_view(),
name='careers.position'),
url(r'^position/(?P<job_id>[\w]+)$', views.JobvitePositionDetailView.as_view(),
Expand Down
19 changes: 3 additions & 16 deletions careers/careers/utils.py
@@ -1,7 +1,4 @@
from itertools import chain

from django_jobvite import models as jobvite_models
from careers.django_workable import models as workable_models


def get_all_positions(filters=None, order_by=None):
Expand All @@ -13,22 +10,12 @@ def order_by_function(x):
return x.title
order_by = order_by_function

return (
sorted(
chain(workable_models.Position.objects.filter(**filters),
jobvite_models.Position.objects.filter(**filters)),
key=order_by))
return sorted(jobvite_models.Position.objects.filter(**filters), key=order_by)


def get_all_categories():
return (
sorted(set(
chain(jobvite_models.Category.objects.values_list('name', flat=True),
workable_models.Category.objects.values_list('name', flat=True)))))
return sorted(set(jobvite_models.Category.objects.values_list('name', flat=True)))


def get_all_position_types():
return (
sorted(set(
chain(jobvite_models.Position.objects.values_list('job_type', flat=True),
workable_models.Position.objects.values_list('job_type', flat=True)))))
return sorted(set(jobvite_models.Position.objects.values_list('job_type', flat=True)))
16 changes: 0 additions & 16 deletions careers/careers/views.py
Expand Up @@ -5,7 +5,6 @@

import utils
from careers.careers.forms import PositionFilterForm
from careers.django_workable import models as workable_models


def home(request):
Expand Down Expand Up @@ -37,18 +36,3 @@ def get_context_data(self, **kwargs):
filters={'category__name': context['position'].category.name},
order_by=lambda x: x.title)
return context


class WorkablePositionDetailView(DetailView):
context_object_name = 'position'
model = workable_models.Position
template_name = 'careers/position.jinja'
slug_field = 'shortcode'
slug_url_kwarg = 'shortcode'

def get_context_data(self, **kwargs):
context = super(WorkablePositionDetailView, self).get_context_data(**kwargs)
context['positions'] = utils.get_all_positions(
filters={'category__name': context['position'].category.name},
order_by=lambda x: x.title)
return context
Empty file.
9 changes: 0 additions & 9 deletions careers/django_workable/admin.py

This file was deleted.

Empty file.
Empty file.
93 changes: 0 additions & 93 deletions careers/django_workable/management/commands/syncworkable.py

This file was deleted.

35 changes: 0 additions & 35 deletions careers/django_workable/migrations/0001_initial.py

This file was deleted.

Empty file.
37 changes: 0 additions & 37 deletions careers/django_workable/models.py

This file was deleted.

30 changes: 0 additions & 30 deletions careers/django_workable/tests/__init__.py

This file was deleted.

0 comments on commit fc5e3bc

Please sign in to comment.