Add unit test for gitweb.generate_project_list.
This commit is contained in:
parent
8bbf93c532
commit
2487c658ba
1 changed files with 19 additions and 1 deletions
|
@ -5,7 +5,7 @@ from ConfigParser import RawConfigParser
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
from gitosis import gitweb
|
from gitosis import gitweb
|
||||||
from gitosis.test.util import mkdir, maketemp
|
from gitosis.test.util import mkdir, maketemp, readFile
|
||||||
|
|
||||||
def test_projectsList_empty():
|
def test_projectsList_empty():
|
||||||
cfg = RawConfigParser()
|
cfg = RawConfigParser()
|
||||||
|
@ -105,3 +105,21 @@ def test_projectsList_reallyEndsWithGit():
|
||||||
eq(got.getvalue(), '''\
|
eq(got.getvalue(), '''\
|
||||||
foo.git
|
foo.git
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
def test_projectsList_path():
|
||||||
|
tmp = maketemp()
|
||||||
|
path = os.path.join(tmp, 'foo.git')
|
||||||
|
mkdir(path)
|
||||||
|
cfg = RawConfigParser()
|
||||||
|
cfg.add_section('gitosis')
|
||||||
|
cfg.set('gitosis', 'repositories', tmp)
|
||||||
|
cfg.add_section('repo foo')
|
||||||
|
cfg.set('repo foo', 'gitweb', 'yes')
|
||||||
|
projects_list = os.path.join(tmp, 'projects.list')
|
||||||
|
gitweb.generate_project_list(
|
||||||
|
config=cfg,
|
||||||
|
path=projects_list)
|
||||||
|
got = readFile(projects_list)
|
||||||
|
eq(got, '''\
|
||||||
|
foo.git
|
||||||
|
''')
|
||||||
|
|
Loading…
Reference in a new issue