Exemplo n.º 1
0
    def test_issue_invalid_issn(self):
        from ratchet.views import issue

        request = testing.DummyRequest(db=self.collection)
        request.matchdict.update(dict(code='xxx'))

        with self.assertRaises(httpexceptions.HTTPBadRequest):
            issue(request)
Exemplo n.º 2
0
    def test_issue(self):
        from ratchet.views import issue, 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

        request = testing.DummyRequest(db=self.collection)
        request.matchdict.update(dict(code='0104-776020140001'))

        response = issue(request)        

        self.assertEqual(response['code'], '0104-776020140001')
        self.assertEqual(response['total'], 1)