コード例 #1
0
ファイル: test_views.py プロジェクト: fabiobatalha/ratchet
    def test_issues_offset_exceeded_gt(self):
        from ratchet.views import issues, general_post

        post_data = {'code': '0104-776020140001', 'page': 'toc', 'type': 'issue', 'access_date': '2014-12-25'}

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

        try:
            general_post(request)
        except:
            pass

        post_data = {'code': '0100-076020140001', 'page': 'toc', 'type': 'issue', '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 = issues(request) 
コード例 #2
0
ファイル: test_views.py プロジェクト: fabiobatalha/ratchet
    def test_issues(self):
        from ratchet.views import issues, general_post

        post_data = {'code': '0104-776020140001', 'page': 'toc', 'type': 'issue', 'access_date': '2014-12-25'}

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

        try:
            general_post(request)
        except:
            pass

        post_data = {'code': '0100-076020140001', 'page': 'toc', 'type': 'issue', '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 = issues(request)        

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