def setup_method(self, method):
        self.config = Config()
        self.config.plugins = Config()
        self.config.plugins['aminator.plugins.provisioner.yum'] = self.config.from_file(yaml_file='yum_test.yml')

        self.plugin = YumProvisionerPlugin()
        self.plugin._config = self.config
class TestYumProvisionerPlugin(object):

    def setup_method(self, method):
        self.config = Config()
        self.config.plugins = Config()
        self.config.plugins['aminator.plugins.provisioner.yum'] = self.config.from_file(yaml_file='yum_test.yml')

        self.plugin = YumProvisionerPlugin()
        self.plugin._config = self.config

    def test_deactivate_active_services(self):

        files = self.plugin._config.plugins['aminator.plugins.provisioner.yum'].get('short_circuit_files', [])

        if len(files) != 1:
            raise AttributeError("incorrect number of files specified.  found %d expected 1", len(files))

        filename = files[0]

        if not os.path.isdir(os.path.dirname(filename)):
            os.makedirs(os.path.dirname(filename))

        # cleanup
        if os.path.islink(filename):
            log.debug("removing %s", filename)
            os.remove(filename)

        with open(filename, 'w') as f:
            log.debug("writing %s", filename)
            f.write("test")
            log.debug("wrote %s", filename)

        assert self.plugin._deactivate_provisioning_service_block()
        assert True == os.path.islink('/tmp/sbin/service')
        assert self.plugin._activate_provisioning_service_block()
        assert False == os.path.islink('/tmp/sbin/service')