Param values are strings, not bools.

All tests now pass!
merge-requests/2/head
Marnanel Thurman 2021-02-18 19:24:48 +00:00
rodzic 574176b42b
commit 71c6d26ad8
2 zmienionych plików z 11 dodań i 13 usunięć

Wyświetl plik

@ -154,7 +154,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'local': True},
data = {'local': 'true'},
),
'AC',
)
@ -162,7 +162,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'local': False},
data = {'local': 'false'},
),
'ABCD',
)
@ -170,7 +170,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'remote': True},
data = {'remote': 'true'},
),
'BD',
)
@ -178,7 +178,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'remote': False},
data = {'remote': 'false'},
),
'ABCD',
)
@ -186,7 +186,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'local': True, 'remote': True},
data = {'local': 'true', 'remote': 'true'},
),
'',
)
@ -206,7 +206,7 @@ class TestPublicTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/public',
data = {'only_media': True},
data = {'only_media': 'true'},
),
'',
)
@ -473,7 +473,7 @@ class TestHomeTimeline(TimelineTestCase):
self.assertEqual(
self.timeline_contents(
path = '/api/v1/timelines/home',
data = {'local': True},
data = {'local': 'true'},
as_user = self.alice,
),
'AD',

Wyświetl plik

@ -73,17 +73,15 @@ class AbstractTimeline(generics.ListAPIView):
)
logger.debug(" -- after since_id: %s", queryset)
if 'local' in self.request.query_params:
if self.request.query_params.get('local', '')=='true':
queryset = queryset.filter(
remote_url__isnull = \
bool(self.request.query_params['local']),
remote_url__isnull = True,
)
logger.debug(" -- after local: %s", queryset)
if 'remote' in self.request.query_params:
if self.request.query_params.get('remote', '')=='true':
queryset = queryset.filter(
remote_url__isnull = \
not bool(self.request.query_params['remote']),
remote_url__isnull = False,
)
logger.debug(" -- after remote: %s", queryset)