Skip to content

Commit

Permalink
Fix filters fields kwargs, update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dougppaz committed Oct 10, 2018
1 parent b782d3d commit 1cd3b44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
14 changes: 7 additions & 7 deletions bothub/api/v2/examples/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ class Meta:
]

repository_uuid = filters.CharFilter(
name='repository_uuid',
field_name='repository_uuid',
method='filter_repository_uuid',
required=True,
help_text=_('Repository\'s UUID'))
language = filters.CharFilter(
name='language',
field_name='language',
method='filter_language',
help_text='Filter by language, default is repository base language')
has_translation = filters.BooleanFilter(
name='has_translation',
field_name='has_translation',
method='filter_has_translation',
help_text=_('Filter for examples with or without translation'))
has_not_translation_to = filters.CharFilter(
name='has_not_translation_to',
field_name='has_not_translation_to',
method='filter_has_not_translation_to')
order_by_translation = filters.CharFilter(
name='order_by_translation',
field_name='order_by_translation',
method='filter_order_by_translation',
help_text=_('Order examples with translation by language'))
label = filters.CharFilter(
name='label',
field_name='label',
method='filter_label',
help_text=_('Filter for examples with entities with specific label.'))
entity = filters.CharFilter(
name='entity',
field_name='entity',
method='filter_entity',
help_text=_('Filter for examples with entity.'))

Expand Down
5 changes: 1 addition & 4 deletions bothub/api/v2/examples/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ def test_withuout_repository_uuid(self):
response, content_data = self.request()
self.assertEqual(
response.status_code,
status.HTTP_200_OK)
self.assertEqual(
content_data.get('count'),
0)
status.HTTP_400_BAD_REQUEST)

def test_filter_text(self):
response, content_data = self.request({
Expand Down

0 comments on commit 1cd3b44

Please sign in to comment.