def test_patch_documents_bundle_calls_update_documents_bundle(self):
     self.request.matchdict["bundle_id"] = "0034-8910-rsp-48-2"
     self.request.validated = apptesting.documents_bundle_registry_data_fixture(
     )
     expected = deepcopy(self.request.validated)
     MockUpdateDocumentsBundle = Mock()
     self.request.services[
         "update_documents_bundle_metadata"] = MockUpdateDocumentsBundle
     restfulapi.patch_documents_bundle(self.request)
     MockUpdateDocumentsBundle.assert_called_once_with("0034-8910-rsp-48-2",
                                                       metadata=expected)
 def test_put_documents_bundle_returns_204_if_updated(self):
     self.request.matchdict["bundle_id"] = "0034-8910-rsp-48-2"
     self.request.validated = apptesting.documents_bundle_registry_data_fixture(
     )
     self.request.services["update_documents_bundle_metadata"] = Mock()
     response = restfulapi.patch_documents_bundle(self.request)
     self.assertIsInstance(response, HTTPNoContent)
 def test_patch_documents_bundle_return_404_if_no_bundle_found(self):
     self.request.matchdict["bundle_id"] = "0034-8910-rsp-48-2"
     self.request.validated = apptesting.documents_bundle_registry_data_fixture(
     )
     MockUpdateDocumentsBundle = Mock(
         side_effect=exceptions.DoesNotExist("Does Not Exist"))
     self.request.services[
         "update_documents_bundle_metadata"] = MockUpdateDocumentsBundle
     response = restfulapi.patch_documents_bundle(self.request)
     self.assertIsInstance(response, HTTPNotFound)