Permalink
Browse files

More Python unit tests.

Signed-off-by: Volker Theile <votdev@gmx.de>
  • Loading branch information...
votdev committed Nov 8, 2018
1 parent c65eb7c commit c1f598123aefa7afe333d88c5cd5ff86d25b2fae
@@ -27,23 +27,10 @@ class ConfDbAdmTestCase(unittest.TestCase):
def setUp(self):
self.command_helper = openmediavault.confdbadm.CommandHelper()
@mock.patch("openmediavault.confdbadm.CommandHelper.unlink_backup")
@mock.patch("openmediavault.confdbadm.CommandHelper.rollback_changes")
@mock.patch("openmediavault.confdbadm.CommandHelper.create_backup")
def test_create_class(
self, mock_create_backup, mock_rollback_changes, mock_unlink_backup
):
class Command(openmediavault.confdbadm.CommandHelper):
def run_test(self):
self.create_backup()
self.rollback_changes()
self.unlink_backup()
command = Command()
command.run_test()
mock_create_backup.assert_called_once()
mock_rollback_changes.assert_called_once()
mock_unlink_backup.assert_called_once()
def test_has_methods(self):
self.assertTrue(hasattr(self.command_helper, 'create_backup'))
self.assertTrue(hasattr(self.command_helper, 'unlink_backup'))
self.assertTrue(hasattr(self.command_helper, 'rollback_changes'))
def test_create_backup_fail(self):
openmediavault.setenv("OMV_CONFIG_FILE", "xyz.conf")

0 comments on commit c1f5981

Please sign in to comment.