def setUp(self): self.nulecule_base = Nulecule_Base(dryrun=True) self.tmpdir = tempfile.mkdtemp(prefix="atomicapp-test", dir="/tmp") self.artifact_dir = os.path.dirname( __file__) + '/docker_artifact_test/' self.plugin = Plugin() self.plugin.load_plugins()
def __init__(self, config, basepath, graph, provider, dryrun): self.plugin = Plugin() self.config = config self.basepath = basepath self.graph = graph self.dryrun = dryrun # We initialize the provider in order to gather provider-specific # information p = self.plugin.getProvider(provider) self.provider = p(config, basepath, dryrun) self.provider.init()
def test_getProvider(self): """ Test if getProvider is returning appropriate classes to the corresponding keys. """ p = Plugin() docker_mock = mock.Mock() kubernetes_mock = mock.Mock() # keep some mock objects in place of the actual corresponding # classes, getProvider reads from `plugins` dict. p.plugins = { 'docker': docker_mock, 'kubernetes': kubernetes_mock, } self.assertEqual(p.getProvider('docker'), docker_mock) self.assertEqual(p.getProvider('kubernetes'), kubernetes_mock) # if non-existent key provided self.assertEqual(p.getProvider('some_random'), None)
# -*- coding: utf-8 -*- from atomicapp.constants import (GLOBAL_CONF, DEFAULT_PROVIDER, DEFAULT_ANSWERS) from atomicapp.utils import Utils from atomicapp.plugin import Plugin plugin = Plugin() plugin.load_plugins() class NuleculeBase(object): """ This is the base class for Nulecule and NuleculeComponent in atomicapp.nulecule.base. """ def __init__(self, basepath, params, namespace): self.basepath = basepath self.params = params or [] self.namespace = namespace def load(self): pass def load_config(self, config=None, ask=False, skip_asking=False): """ Load config data. Sets the loaded config data to self.config. Args: config (dict): Initial config data ask (bool): When True, ask for values for a param from user even if the param has a default value
def __init__(self, basepath, params, namespace): self.plugin = Plugin() self.plugin.load_plugins() self.basepath = basepath self.params = params or [] self.namespace = namespace
def setUp(self): self.nulecule_base = Nulecule_Base(dryrun=True) self.tmpdir = tempfile.mkdtemp(prefix="atomicapp-test", dir="/tmp") self.plugin = Plugin() self.plugin.load_plugins()