def test_journal_invalid_issn(self): from ratchet.views import journal request = testing.DummyRequest(db=self.collection) request.matchdict.update(dict(code='xxx')) with self.assertRaises(httpexceptions.HTTPBadRequest): journal(request)
def test_journal(self): from ratchet.views import journal, 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 request = testing.DummyRequest(db=self.collection) request.matchdict.update(dict(code='0104-7760')) response = journal(request) self.assertEqual(response['code'], '0104-7760') self.assertEqual(response['total'], 1)