Beispiel #1
0
 def test_ingest_publish_from_cli(self):
     args = [self.nom, '--ingest+publish', '--id', self.msid, '--version', self.version, self.ajson_fixture1]
     errcode, stdout = self.call_command(*args)
     self.assertEqual(errcode, 0)
     # article has been ingested
     av = models.ArticleVersion.objects.get(article__manuscript_id=self.msid, version=self.version)
     # article has been published
     self.assertTrue(av.published())
     # ensure response is json and well-formed
     result = json.loads(stdout.getvalue())
     self.assertTrue(utils.has_all_keys(result, ['status', 'id', 'datetime']))
     # ensure response data is correct
     self.assertEqual(result['status'], 'published')
     self.assertEqual(result['datetime'], utils.ymdhms(av.datetime_published))
Beispiel #2
0
 def test_ingest_from_cli(self):
     "ingest script requires the --ingest flag and a source of data"
     args = [self.nom, '--ingest', '--id', self.msid, '--version', self.version, self.ajson_fixture1]
     errcode, stdout = self.call_command(*args)
     self.assertEqual(errcode, 0)
     # article has been ingested
     self.assertEqual(models.ArticleVersion.objects.count(), 1)
     # message returned is json encoded with all the right keys and values
     result = json.loads(stdout.getvalue())
     self.assertTrue(utils.has_all_keys(result, ['status', 'id', 'datetime']))
     self.assertEqual(result['status'], 'ingested')
     # the date and time is roughly the same as right now, ignoring microseconds
     expected_datetime = utils.ymdhms(utils.utcnow())
     self.assertEqual(result['datetime'][:20], expected_datetime[:20])
     self.assertEqual(result['datetime'][-6:], expected_datetime[-6:])
Beispiel #3
0
 def test_ingest_publish_from_cli(self):
     args = [
         self.nom, '--ingest+publish', '--id', self.msid, '--version',
         self.version, self.ajson_fixture1
     ]
     errcode, stdout = self.call_command(*args)
     self.assertEqual(errcode, 0)
     # article has been ingested
     av = models.ArticleVersion.objects.get(
         article__manuscript_id=self.msid, version=self.version)
     # article has been published
     self.assertTrue(av.published())
     # ensure response is json and well-formed
     result = json.loads(stdout)
     self.assertTrue(
         utils.has_all_keys(result, ['status', 'id', 'datetime']))
     # ensure response data is correct
     self.assertEqual(result['status'], 'published')
     self.assertEqual(result['datetime'],
                      utils.ymdhms(av.datetime_published))