def setUp(self): """We have a submission.""" self.app = create_app() self.creator = User(native_id=1234, email='*****@*****.**', forename='Ross', surname='Perot') self.submission_id = 12345 self.before = Submission( submission_id=self.submission_id, metadata=mock.MagicMock( title="The best title", authors_display="Frank Underwood (POTUS)", abstract= "Pork loin meatloaf meatball in cow et. Tail pork ut velit, eu prosciutto pork chop pariatur ad non hamburger bacon cupidatat. Short loin nulla aute esse spare ribs eiusmod consequat anim capicola chuck cupim labore alcatra strip steak tail. Lorem short ribs andouille leberkas pork belly. Andouille fatback ham hock burgdoggen, ham pork belly labore doner aute esse.", comments= "Aliqua ham capicola minim filet mignon tenderloin voluptate bacon biltong shank in chuck do pig in. Id pariatur jowl ad ham pork chop doner buffalo laboris sed ut", msc_class="14J60 (Primary), 14F05, 14J26 (Secondary)", acm_class="F.2.2; I.2.7", journal_ref="Nature 2021 39202:32-12", report_num="Report 1234", doi="10.00123/43463"), source_content=mock.MagicMock(uncompressed_size=392019), version=1, primary_classification=mock.MagicMock(category='cs.DL'), license=mock.MagicMock(uri='http://some.license/v2'), creator=self.creator, owner=self.creator, created=datetime(2018, 3, 4, 18, 34, 2, tzinfo=UTC), submitted=datetime(2018, 3, 4, 19, 34, 2, tzinfo=UTC), status=Submission.WORKING) self.after = Submission( submission_id=12345, metadata=mock.MagicMock( title="The best title", authors_display="Frank Underwood (POTUS)", abstract= "Pork loin meatloaf meatball in cow et. Tail pork ut velit, eu prosciutto pork chop pariatur ad non hamburger bacon cupidatat. Short loin nulla aute esse spare ribs eiusmod consequat anim capicola chuck cupim labore alcatra strip steak tail. Lorem short ribs andouille leberkas pork belly. Andouille fatback ham hock burgdoggen, ham pork belly labore doner aute esse.", comments= "Aliqua ham capicola minim filet mignon tenderloin voluptate bacon biltong shank in chuck do pig in. Id pariatur jowl ad ham pork chop doner buffalo laboris sed ut", msc_class="14J60 (Primary), 14F05, 14J26 (Secondary)", acm_class="F.2.2; I.2.7", journal_ref="Nature 2021 39202:32-12", report_num="Report 1234", doi="10.00123/43463"), source_content=mock.MagicMock(uncompressed_size=392019), version=1, primary_classification=mock.MagicMock(category='cs.DL'), license=mock.MagicMock(uri='http://some.license/v2'), creator=self.creator, owner=self.creator, created=datetime(2018, 3, 4, 18, 34, 2, tzinfo=UTC), submitted=datetime(2018, 3, 4, 19, 34, 2, tzinfo=UTC), status=Submission.SUBMITTED) self.event = FinalizeSubmission(creator=self.creator, created=datetime.now(UTC)) self.process = SendConfirmationEmail(self.submission_id)
def setUp(self): """We have a submission.""" self.creator = User(native_id=1234, email='*****@*****.**') self.submission = Submission( submission_id=2347441, creator=self.creator, owner=self.creator, created=datetime.now(UTC), source_content=SubmissionContent( identifier='5678', source_format=SubmissionContent.Format('pdf'), checksum='a1b2c3d4', uncompressed_size=58493, compressed_size=58493 ) ) self.submission.submitter_contact_verified = True self.submission.submitter_accepts_policy = True self.submission.license = License(name='foo', uri='http://foo.foo') self.submission.metadata = SubmissionMetadata( title='foo', abstract='oof', authors_display='Bloggs, J' ) self.process = \ ProposeCrossListFromPrimaryCategory(self.submission.submission_id)
def setUp(self): """We have a submission.""" self.creator = User(native_id=1234, email='*****@*****.**') self.submission = Submission(submission_id=2347441, creator=self.creator, owner=self.creator, created=datetime.now(UTC)) self.process = CheckSubmissionSourceSize(self.submission.submission_id)
def setUp(self): """We have a submission.""" self.creator = User(native_id=1234, email='*****@*****.**') self.submission = Submission( submission_id=2347441, creator=self.creator, owner=self.creator, created=datetime.now(UTC), source_content=SubmissionContent( identifier='5678', source_format=SubmissionContent.Format('pdf'), checksum='a1b2c3d4', uncompressed_size=58493, compressed_size=58493)) self.process = CheckPDFSize(self.submission.submission_id)
def test_missing_source(self, mock_plaintext): """There is no source on the submission.""" submission_without_source = Submission(submission_id=2347441, creator=self.creator, owner=self.creator, created=datetime.now(UTC)) trigger = Trigger(event=self.event, actor=self.creator, before=submission_without_source, after=submission_without_source) events = [] with self.app.app_context(): with self.assertRaises(Failed): # Insufficient information to start extraction. self.process.start_extraction(None, trigger, events.append)