Esempio n. 1
0
    def test_journals_offset_exceeded_gt(self):
        from ratchet.views import journals, general_post

        post_data = {'code': '0104-7760', 'page': 'journal', 'type': 'journal', 'access_date': '2014-12-25'}

        request = testing.DummyRequest(post=post_data, db=self.collection)

        try:
            general_post(request)
        except:
            pass

        post_data = {'code': '0100-0760', 'page': 'journal', 'type': 'journal', 'access_date': '2014-12-25'}

        request = testing.DummyRequest(post=post_data, db=self.collection)

        try:
            general_post(request)
        except:
            pass

        request = testing.DummyRequest(params={'offset': 3}, db=self.collection)
    
        with self.assertRaises(httpexceptions.HTTPBadRequest):
            response = journals(request) 
Esempio n. 2
0
    def test_journals(self):
        from ratchet.views import journals, general_post

        post_data = {'code': '0104-7760', 'page': 'journal', 'type': 'journal', 'access_date': '2014-12-25'}

        request = testing.DummyRequest(post=post_data, db=self.collection)

        try:
            general_post(request)
        except:
            pass

        post_data = {'code': '0100-0760', 'page': 'journal', 'type': 'journal', 'access_date': '2014-12-25'}

        request = testing.DummyRequest(post=post_data, db=self.collection)

        try:
            general_post(request)
        except:
            pass

        request = testing.DummyRequest(db=self.collection)

        response = journals(request)        

        self.assertEqual(len(response['objects']), 2)