diff options
| author | Martin Sivak <msivak@redhat.com> | 2010-05-11 17:31:06 +0200 |
|---|---|---|
| committer | Martin Sivak <msivak@redhat.com> | 2010-05-31 14:21:49 +0200 |
| commit | 78421d4ed23ad58b021c4d9d1bae690b99c167fe (patch) | |
| tree | 909c1b650afe9afea03ecf1a03b2d39d39cf72b7 /tests/kickstart_test | |
| parent | 40b979f28cfd73078d5dd58b8f7e97e76198a222 (diff) | |
| download | anaconda-78421d4ed23ad58b021c4d9d1bae690b99c167fe.tar.gz anaconda-78421d4ed23ad58b021c4d9d1bae690b99c167fe.tar.xz anaconda-78421d4ed23ad58b021c4d9d1bae690b99c167fe.zip | |
Structure the repo layout so it matches final structure better and make isys a real Python package.
Also updates the build and autotools stuff to work with the new structure
Diffstat (limited to 'tests/kickstart_test')
| -rw-r--r-- | tests/kickstart_test/Makefile.am | 26 | ||||
| -rw-r--r-- | tests/kickstart_test/commands_test.py | 90 |
2 files changed, 116 insertions, 0 deletions
diff --git a/tests/kickstart_test/Makefile.am b/tests/kickstart_test/Makefile.am new file mode 100644 index 000000000..2483f654f --- /dev/null +++ b/tests/kickstart_test/Makefile.am @@ -0,0 +1,26 @@ +# tests/kickstart/Makefile.am for anaconda +# +# Copyright (C) 2010 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Chris Lumens <clumens@redhat.com> + +EXTRA_DIST = *.py + +MAINTAINERCLEANFILES = Makefile.in + +TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir)/isys/.libs:$(top_builddir)/isys:$(top_builddir) + +TESTS = commands.py diff --git a/tests/kickstart_test/commands_test.py b/tests/kickstart_test/commands_test.py new file mode 100644 index 000000000..fcddced84 --- /dev/null +++ b/tests/kickstart_test/commands_test.py @@ -0,0 +1,90 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Chris Lumens <clumens@redhat.com> +import unittest +import sys +from mock import Mock, patch, TestCase + +class O(object): + pass + +# Verify that each kickstart command in anaconda uses the correct version of +# that command as provided by pykickstart. That is, if there's an FC3 and an +# F10 version of a command, make sure anaconda >= F10 uses the F10 version. +class CommandVersionTestCase(TestCase): + def setUp(self): + self.setupModules([ + 'pyanaconda.isys', + 'pyanaconda.storage', + 'pyanaconda.storage.isys', + 'pyanaconda.storage.devices', + 'pyanaconda.storage.formats', + 'pyanaconda.storage.partitioning', + 'pyanaconda.storage.deviceaction', + 'pyanaconda.storage.devicelibs', + 'pyanaconda.storage.devicelibs.lvm', + 'pyanaconda.storage.iscsi', + 'pyanaconda.storage.fcoe', + 'pyanaconda.storage.zfcp', + 'iutil', + 'constants', + 'flags', + 'anaconda_log', + 'parted', + 'block', + 'baseudev']) + + import pyanaconda.kickstart + import pykickstart.version + + self.handler = pykickstart.version.makeVersion(kickstart.ver) + + def tearDown(self): + self.tearDownModules() + + def runTest(self): + for (commandName, commandObj) in kickstart.commandMap.iteritems(): + baseClass = commandObj().__class__.__bases__[0] + pykickstartClass = self.handler.commands[commandName].__class__ + self.assertEqual(baseClass.__name__, pykickstartClass.__name__) + +# Do the same thing as CommandVersionTestCase, but for data objects. +class DataVersionTestCase(unittest.TestCase): + def setUp(self): + import pyanaconda.kickstart + import pykickstart.version + + self.handler = pykickstart.version.makeVersion(kickstart.ver) + + def runTest(self): + for (dataName, dataObj) in kickstart.dataMap.iteritems(): + baseClass = dataObj().__class__.__bases__[0] + + # pykickstart does not expose data objects a mapping the way it + # does command objects. + pykickstartClass = eval("self.handler.%s" % dataName) + + self.assertEqual(baseClass.__name__, pykickstartClass.__name__) +def suite(): + suite = unittest.TestSuite() + suite.addTest(CommandVersionTestCase()) + suite.addTest(DataVersionTestCase()) + return suite + +s = suite() +unittest.TextTestRunner(verbosity=2).run(s) |
