def __init__(self, **kwargs): super(Main, self).__init__( step_type=constants.IMPORT_STEP_MAIN, plugin_type=constants.WEB_IMPORTER_TYPE_ID, **kwargs) self.remote_id = model.generate_remote_id(self.feed_url) self.add_child(Create()) self.add_child(Summary()) self.add_child(Pull()) self.add_child(Add()) self.add_child(Clean())
def __init__(self, **kwargs): super(Main, self).__init__(step_type=constants.IMPORT_STEP_MAIN, plugin_type=constants.WEB_IMPORTER_TYPE_ID, **kwargs) if not self.feed_url: raise PulpCodedException(errors.OST0004) self.remote_id = model.generate_remote_id(self.feed_url) if self.repair: self.add_child(Repair()) self.add_child(Create()) self.add_child(Summary()) self.add_child(Pull()) self.add_child(Add()) self.add_child(Clean())
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())