summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-25 16:40:01 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-25 16:40:01 -0700
commit892c31bcb49523342c332177c7ed622aa4b25154 (patch)
tree918ff7ad7ef255d2610e7646cb8a479caf5dda2a
parent9065f86cf61ae69968e7d1155d7ecb89688c037c (diff)
downloadportage-892c31bcb49523342c332177c7ed622aa4b25154.tar.gz
portage-892c31bcb49523342c332177c7ed622aa4b25154.tar.bz2
portage-892c31bcb49523342c332177c7ed622aa4b25154.zip
Add test cases for getconfig() bash compatibility with variables
from make.globals.
-rw-r--r--pym/portage/tests/util/test_getconfig.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py
new file mode 100644
index 000000000..3394b0624
--- /dev/null
+++ b/pym/portage/tests/util/test_getconfig.py
@@ -0,0 +1,28 @@
+# Copyright 2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage import os
+from portage.const import PORTAGE_BASE_PATH
+from portage.tests import TestCase
+from portage.util import getconfig
+
+class GetConfigTestCase(TestCase):
+ """
+ Test that getconfig() produces that same result as bash would when
+ sourcing the same input.
+ """
+
+ _cases = {
+ 'FETCHCOMMAND' : '/usr/bin/wget -t 5 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}"',
+ 'FETCHCOMMAND_RSYNC' : 'rsync -avP "${URI}" "${DISTDIR}/${FILE}"',
+ 'FETCHCOMMAND_SSH' : 'bash -c "x=\${2#ssh://} ; exec rsync -avP \\"\${x%%/*}:/\${x#*/}\\" \\"\$1\\"" rsync "${DISTDIR}/${FILE}" "${URI}"',
+ 'PORTAGE_ELOG_MAILSUBJECT' : '[portage] ebuild log for ${PACKAGE} on ${HOST}'
+ }
+
+ def testGetConfig(self):
+
+ make_globals_file = os.path.join(PORTAGE_BASE_PATH,
+ 'cnf', 'make.globals')
+ d = getconfig(make_globals_file)
+ for k, v in self._cases.items():
+ self.assertEqual(d[k], v)