~sirn/fanboi2

572ca8736f804f2da69b80fe4237e5eaea6509be — Kridsada Thanabulpong 4 years ago 126358a
Expose status attribute in board API.
2 files changed, 4 insertions(+), 2 deletions(-)

M fanboi2/serializers.py
M fanboi2/tests/test_serializers.py
M fanboi2/serializers.py => fanboi2/serializers.py +1 -0
@@ 47,6 47,7 @@ def _board_serializer(obj, request):
        'description': obj.description,
        'settings': obj.settings,
        'slug': obj.slug,
        'status': obj.status,
        'title': obj.title,
        'path': request.route_path('api_board', board=obj.slug),
    }

M fanboi2/tests/test_serializers.py => fanboi2/tests/test_serializers.py +3 -2
@@ 64,7 64,7 @@ class TestJSONRendererWithModel(ModelMixin, RegistryMixin, unittest.TestCase):
        self.assertEqual(response[1]['title'], board2.title)

    def test_board(self):
        board = self._makeBoard(title='Foobar', slug='foo')
        board = self._makeBoard(title='Foobar', slug='foo', status='open')
        request = self._makeRequest()
        config = self._makeConfig(request, self._makeRegistry())
        config.add_route('api_board', '/board/{board}/')


@@ 72,10 72,11 @@ class TestJSONRendererWithModel(ModelMixin, RegistryMixin, unittest.TestCase):
        self.assertEqual(response['type'], 'board')
        self.assertEqual(response['title'], 'Foobar')
        self.assertEqual(response['slug'], 'foo')
        self.assertEqual(response['status'], 'open')
        self.assertEqual(response['path'], '/board/foo/')
        self.assertIn('id', response)
        self.assertIn('agreements', response)
        self.assertIn('description', response)
        self.assertIn('id', response)
        self.assertIn('settings', response)
        self.assertNotIn('topics', response)