예제 #1
0
def _validate_resources(config):
    """
    Validates the location of the repo
    """
    repo = url_utils.get_repo(config)

    if not repo.get(constants.CONFIG_URL, None):
        return True, None

    if not factory.is_valid_url(repo['url']):
        msg = 'URL for repo %(url)s is errorous'
        return False, _(msg) % repo

    try:
        url_utils.get_resources(config)
    except (KeyError, TypeError):
        msg = 'Resources error for %(url)s %(dist)s %(component)s %(arch)s'
        return False, _(msg) % repo
    return True, None
 def test_is_valid_url_false(self):
     self.assertFalse(factory.is_valid_url(None))
 def test_is_valid_url(self):
     self.assertTrue(factory.is_valid_url('file://localhost'))