def __init__(self, **kwargs): super(Main, self).__init__( step_type=constants.IMPORT_STEP_MAIN, plugin_type=constants.WEB_IMPORTER_TYPE_ID, **kwargs ) self.feed_url = self.config.get(importer_constants.KEY_FEED) self.branches = self.config.get(constants.IMPORTER_CONFIG_KEY_BRANCHES, []) self.remote_id = model.generate_remote_id(self.feed_url) self.storage_path = os.path.join( constants.SHARED_STORAGE, self.remote_id, constants.CONTENT_DIR) self.add_child(Create()) self.add_child(Pull()) self.add_child(Add())
def test_generate_remote_id(self): url = 'url-test' remote_id = generate_remote_id(url) h = sha256() h.update(url) self.assertEqual(remote_id, h.hexdigest())