def test_should_not_update_if_already_exists_exception_is_raised(self):
     self.request.matchdict["journal_id"] = "example-journal-id"
     self.request.validated = [
         {
             "id": "issue-1",
             "ns": []
         },
         {
             "id": "issue-1",
             "ns": []
         },
     ]
     restfulapi.put_journal_issues(self.request)
     response = restfulapi.get_journal(self.request)
     self.assertEqual([], response.get("items"))
 def test_should_fetch_journal(self):
     self.request.services["fetch_journal"](id="1678-4596-cr-49-02")
     self.request.matchdict = {"journal_id": "1678-4596-cr-49-02"}
     journal_data = restfulapi.get_journal(self.request)
     self.assertIsInstance(journal_data, dict)
 def test_should_return_does_not_exists(self):
     MockFetchJournal = Mock(side_effect=exceptions.DoesNotExist)
     self.request.services["fetch_journal"] = MockFetchJournal
     self.request.matchdict = {"journal_id": "some-random-id-001"}
     self.assertIsInstance(restfulapi.get_journal(self.request),
                           HTTPNotFound)