aboutsummaryrefslogtreecommitdiff
path: root/gitosis/test/test_gitweb.py
diff options
context:
space:
mode:
authorTommi Virtanen <tv@eagain.net>2007-06-04 22:12:29 +0300
committerTommi Virtanen <tv@eagain.net>2007-06-05 13:39:24 +0300
commit418c5c3cfc5812f2ea1dfc5219c43ab549878062 (patch)
tree20c88efbf28f150eca318da3ae421ecc859c8fe2 /gitosis/test/test_gitweb.py
parentRemove completed todo entries. (diff)
downloadgitosis-dakkar-418c5c3cfc5812f2ea1dfc5219c43ab549878062.tar.gz
gitosis-dakkar-418c5c3cfc5812f2ea1dfc5219c43ab549878062.tar.bz2
gitosis-dakkar-418c5c3cfc5812f2ea1dfc5219c43ab549878062.zip
Add ``gitosis-gitweb``, for writing gitweb project lists.
Takes the list of repositories to publish from the gitosis config file.
Diffstat (limited to 'gitosis/test/test_gitweb.py')
-rw-r--r--gitosis/test/test_gitweb.py97
1 files changed, 97 insertions, 0 deletions
diff --git a/gitosis/test/test_gitweb.py b/gitosis/test/test_gitweb.py
new file mode 100644
index 0000000..4308371
--- /dev/null
+++ b/gitosis/test/test_gitweb.py
@@ -0,0 +1,97 @@
+from nose.tools import eq_ as eq
+
+from ConfigParser import RawConfigParser
+from cStringIO import StringIO
+
+from gitosis import gitweb
+
+def test_empty():
+ cfg = RawConfigParser()
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+''')
+
+def test_trickyFilenames():
+ cfg = RawConfigParser()
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+''')
+
+def test_projectsList_repoDenied():
+ cfg = RawConfigParser()
+ cfg.add_section('repo foo/bar')
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+''')
+
+def test_projectsList_noOwner():
+ cfg = RawConfigParser()
+ cfg.add_section('repo foo/bar')
+ cfg.set('repo foo/bar', 'gitweb', 'yes')
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+foo%2Fbar
+''')
+
+def test_projectsList_haveOwner():
+ cfg = RawConfigParser()
+ cfg.add_section('repo foo/bar')
+ cfg.set('repo foo/bar', 'gitweb', 'yes')
+ cfg.set('repo foo/bar', 'owner', 'John Doe')
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+foo%2Fbar John+Doe
+''')
+
+def test_projectsList_multiple():
+ cfg = RawConfigParser()
+ cfg.add_section('gitosis')
+ cfg.add_section('repo foo/bar')
+ cfg.set('repo foo/bar', 'owner', 'John Doe')
+ cfg.set('repo foo/bar', 'gitweb', 'yes')
+ cfg.add_section('repo quux')
+ cfg.set('repo quux', 'gitweb', 'yes')
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+quux
+foo%2Fbar John+Doe
+''')
+
+def test_projectsList_multiple_globalGitwebYes():
+ cfg = RawConfigParser()
+ cfg.add_section('gitosis')
+ cfg.set('gitosis', 'gitweb', 'yes')
+ cfg.add_section('repo foo/bar')
+ cfg.set('repo foo/bar', 'owner', 'John Doe')
+ cfg.add_section('repo quux')
+ # same as default, no effect
+ cfg.set('repo quux', 'gitweb', 'yes')
+ cfg.add_section('repo thud')
+ # this is still hidden
+ cfg.set('repo thud', 'gitweb', 'no')
+ got = StringIO()
+ gitweb.generate(
+ config=cfg,
+ fp=got)
+ eq(got.getvalue(), '''\
+quux
+foo%2Fbar John+Doe
+''')