Ejemplo n.º 1
0
    def setUp(self):
        self.logger = importers.Logger()

        self.action_log_args = {
            "log_type": importers.ACTION,
            "message": "action_log_args",
            "context": {
                "foo": "bar",
                "baz": "bonk",
            },
        }

        self.error_log_args = {
            "log_type": importers.ERROR,
            "message": "error_log_args",
            "context": {
                "noo": "boo",
                "can": "haz",
            },
        }

        self.warning_log_args = {
            "log_type": importers.WARNING,
            "message": "warning_log_args",
            "context": {
                "blu": "red",
                "grn": "ylw",
            },
        }
Ejemplo n.º 2
0
 def setUp(self):
     self.fake_base_url = "http://localhost:8000"
     self.mk_main()
     self.record_keeper = importers.RecordKeeper()
     self.logger = importers.Logger()
     self.importer = importers.ContentImporter(
         self.site.pk, self.fake_base_url,
         record_keeper=self.record_keeper,
         logger=self.logger)
Ejemplo n.º 3
0
    def test_image_not_imported_logs_error(self):
        content = constants.ARTICLE_WITH_ONLY_IMAGE_RESPONSE
        content_copy = dict(content)

        # Break the assumptions that the images have already
        # been imported thus the record keeper has mapped
        # the relationship

        record_keeper = importers.RecordKeeper()
        logger = importers.Logger()

        class_ = ArticlePage

        ArticlePage.create_page(content_copy,
                                class_,
                                record_keeper=record_keeper,
                                logger=logger)

        self.assertTrue(len(logger.record), 1)
        error_log = logger.record[0]
        self.assertEqual(error_log["log_type"], ERROR)