Ejemplo n.º 1
0
    def test_get_recordset_info(self):
        ids = [co.id for co in self.collectionobjects]

        for id in ids:
            self.recordset.recordsetitems.create(recordid=id)

        for i, co in enumerate(self.collectionobjects):
            info = api.get_recordset_info(co, self.recordset.id)
            self.assertEqual(info['recordsetid'], self.recordset.id)
            self.assertEqual(info['total_count'], len(self.collectionobjects))
            self.assertEqual(info['index'], i)
            self.assertEqual(info['previous'], None if i == 0 else \
                                 api.uri_for_model('collectionobject', self.collectionobjects[i-1].id))

            self.assertEqual(info['next'], None if i == len(self.collectionobjects) - 1 else \
                                 api.uri_for_model('collectionobject', self.collectionobjects[i+1].id))
Ejemplo n.º 2
0
    def test_get_recordset_info(self):
        ids = [co.id for co in self.collectionobjects]

        for id in ids:
            self.recordset.recordsetitems.create(recordid=id)

        for i, co in enumerate(self.collectionobjects):
            info = api.get_recordset_info(co, self.recordset.id)
            self.assertEqual(info['recordsetid'], self.recordset.id)
            self.assertEqual(info['total_count'], len(self.collectionobjects))
            self.assertEqual(info['index'], i)
            self.assertEqual(info['previous'], None if i == 0 else \
                                 api.uri_for_model('collectionobject', self.collectionobjects[i-1].id))

            self.assertEqual(info['next'], None if i == len(self.collectionobjects) - 1 else \
                                 api.uri_for_model('collectionobject', self.collectionobjects[i+1].id))
Ejemplo n.º 3
0
 def test_no_recordset_info(self):
     info = api.get_recordset_info(self.collectionobjects[0],
                                   self.recordset.id)
     self.assertEqual(info, None)
Ejemplo n.º 4
0
 def test_no_recordset_info(self):
     info = api.get_recordset_info(self.collectionobjects[0], self.recordset.id)
     self.assertEqual(info, None)