def test_next_link_present(self):
     meta = {'next': '?limit=1&offset=1'}
     api_path = '/a/odata-test/api/v0.5/odata/forms/config_id'
     self.assertEqual(
         ODataFormSerializer.get_next_url(meta, api_path),
         'http://localhost:8000/a/odata-test/api/v0.5/odata/forms/config_id?limit=1&offset=1'
     )
 def test_missing_value_is_null(self):
     self.assertEqual(
         ODataFormSerializer.serialize_forms_using_config(
             [{}],
             FormExportInstance(tables=[
                 TableConfiguration(columns=[
                     ExportColumn(
                         label='user-id',
                         item=ExportItem(path=[PathNode(name='user_id')]),
                         selected=True,
                     )
                 ])
             ])), [{
                 'user-id': '---'
             }])
 def test_unselected_column_excluded(self):
     self.assertEqual(
         ODataFormSerializer.serialize_forms_using_config(
             [{
                 'user_id': 'the-user-id'
             }],
             FormExportInstance(tables=[
                 TableConfiguration(columns=[
                     ExportColumn(
                         label='user-id',
                         item=ExportItem(path=[PathNode(name='user_id')]),
                         selected=False,
                     )
                 ])
             ])), [{}])
Esempio n. 4
0
 class Meta(v0_4.XFormInstanceResource.Meta):
     authentication = ODataAuthentication()
     resource_name = 'odata/forms'
     serializer = ODataFormSerializer()
     limit = 2000
     max_limit = 10000
 def test_next_link_absent(self):
     meta = {'next': None}
     api_path = '/a/odata-test/api/v0.5/odata/forms/config_id'
     self.assertEqual(ODataFormSerializer.get_next_url(meta, api_path),
                      None)