Exemple #1
0
def test_get_mirrors_with_all():
    cfg = get_config()
    mirrors = list(mirror.get_mirrors(cfg, 'baz'))
    eq(0, len(mirrors))
    
    cfg.add_section('mirror github')
    cfg.set('mirror github', 'repos', '@all')
    cfg.set('mirror github', 'uri', '[email protected]:res0nat0r/%s.git')
    mirrors = list(mirror.get_mirrors(cfg, 'baz'))
    ok('[email protected]:res0nat0r/baz.git' in mirrors)
    eq(1, len(mirrors))
Exemple #2
0
def test_get_mirrors_with_all():
    cfg = get_config()
    mirrors = list(mirror.get_mirrors(cfg, "baz"))
    eq(0, len(mirrors))

    cfg.add_section("mirror github")
    cfg.set("mirror github", "repos", "@all")
    cfg.set("mirror github", "uri", "[email protected]:res0nat0r/%s.git")
    mirrors = list(mirror.get_mirrors(cfg, "baz"))
    ok("[email protected]:res0nat0r/baz.git" in mirrors)
    eq(1, len(mirrors))
Exemple #3
0
def test_get_mirrors():
    cfg = get_config()
    cfg.add_section('mirror github')
    cfg.set('mirror github', 'repos', 'foo bar')
    cfg.set('mirror github', 'uri', '[email protected]:res0nat0r/%s.git')
    mirrors = list(mirror.get_mirrors(cfg, 'foo'))
    ok('/var/bar' in mirrors)
    ok('/var/baz' in mirrors)
    ok('[email protected]:res0nat0r/foo.git' in mirrors)
    eq(3, len(mirrors))
    
    mirrors = list(mirror.get_mirrors(cfg, 'bar'))
    ok('[email protected]:res0nat0r/bar.git' in mirrors)
    eq(1, len(mirrors))
Exemple #4
0
def test_get_mirrors():
    cfg = get_config()
    cfg.add_section("mirror github")
    cfg.set("mirror github", "repos", "foo bar")
    cfg.set("mirror github", "uri", "[email protected]:res0nat0r/%s.git")
    mirrors = list(mirror.get_mirrors(cfg, "foo"))
    ok("/var/bar" in mirrors)
    ok("/var/baz" in mirrors)
    ok("[email protected]:res0nat0r/foo.git" in mirrors)
    eq(3, len(mirrors))

    mirrors = list(mirror.get_mirrors(cfg, "bar"))
    ok("[email protected]:res0nat0r/bar.git" in mirrors)
    eq(1, len(mirrors))
Exemple #5
0
def test_get_mirrors_with_all():
    cfg = get_config(extra=BACKUP_EXTRA_CONFIG)
    mirrors = list(mirror.get_mirrors(cfg, 'foo'))
    ok('/var/www/foo' in mirrors)
    ok('/var/trac/foo/repo' in mirrors)
    ok('[email protected]:repositories/foo.git' in mirrors)
    eq(3, len(mirrors))
Exemple #6
0
def test_get_mirrors_from_mirror_section():
    mirrors = list(mirror.get_mirrors(get_config(), 'baz'))
    ok('[email protected]:alice/baz.git' in mirrors)
    ok('[email protected]:baz/mainline.git' in mirrors)
    eq(2, len(mirrors))
Exemple #7
0
def test_get_mirrors_from_repo_section():
    mirrors = list(mirror.get_mirrors(get_config(), 'foo'))
    ok('/var/www/foo' in mirrors)
    ok('/var/trac/foo/repo' in mirrors)
    eq(2, len(mirrors))
Exemple #8
0
def test_get_mirrors_from_mirror_and_repo_sections():
    mirrors = list(mirror.get_mirrors(get_config(), 'bar'))
    ok('[email protected]:alice/bar.git' in mirrors)
    ok('[email protected]:bar/mainline.git' in mirrors)
    ok('/var/www/bar' in mirrors)
    eq(3, len(mirrors))