Merge branch 'develop' into #8976

* develop:
  Integration testing for #8976
This commit is contained in:
Mike Place 2013-12-04 12:34:47 -07:00
commit 8c31d96e17

View File

@ -1,11 +1,38 @@
# -*- coding: utf-8 -*-
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
from salttesting.helpers import (ensure_in_syspath, destructiveTest)
ensure_in_syspath('../../')
# Import salt libs
import integration
from salt.modules import disk
# Import Python libs
import os
import shutil
class DiskModuleVirtualizationTest(integration.ModuleCase):
'''
Test to make sure we return a clean result under Docker. Refs #8976
This is factored into its own class so that we can have some certainty that setUp() and tearDown() are run.
'''
@destructiveTest
def setUp(self):
# Make /etc/mtab unreadable
if os.path.isfile('/etc/mtab'):
shutil.move('/etc/mtab', '/tmp/mtab')
@destructiveTest
def test_no_mtab(self):
ret = self.run_function('disk.usage')
self.assertDictEqual(ret, {})
@destructiveTest
def tearDown(self):
if os.path.isfile('/tmp/mtab'):
shutil.move('/tmp/mtab', '/etc/mtab')
class DiskModuleTest(integration.ModuleCase):