def test_load_without_init(self): try: os.remove('test/data/plugins/test5/__init__.py') os.remove('test/data/plugins/test5/__init__.pyc') except IOError: pass utils.load_extension('test/data/plugins/test5') assert os.path.exists('test/data/plugins/test5/__init__.py')
def test_load_test5(self): test5 = utils.load_extension('test/data/plugins/test5') ctx = {} res = test5.configure(ctx) assert res is None assert 'ADDED_BY_EXTENSION' in ctx.keys() assert ctx['ADDED_BY_EXTENSION']
def test_load_test4then3(self): test4 = utils.load_extension('test/data/plugins/test4') ctx = {} try: test4.configure(ctx) except ValueError, e: eq_('Intentional', str(e))
import os.path import tempfile import shutil from nose.tools import eq_ from build_pack_utils import utils from dingus import Dingus from common.integration import ErrorHelper from common.components import BuildPackAssertHelper from common.components import HttpdAssertHelper from common.components import PhpAssertHelper from common.components import DownloadAssertHelper from common.components import CodizyAssertHelper from common.base import BaseCompileApp codizy_extn = utils.load_extension('extensions/codizy') class TestCodizyInstaller(object): def setUp(self): self.build_dir = tempfile.mkdtemp(prefix='build-') phpCfgDir = os.path.join(self.build_dir, 'php', 'etc') os.makedirs(phpCfgDir) shutil.copy('defaults/config/php/5.4.x/php.ini', phpCfgDir) shutil.copy('defaults/config/php/5.4.x/php-fpm.conf', phpCfgDir) def tearDown(self): if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir)
test4.configure(ctx) except ValueError, e: eq_('Intentional', str(e)) def test_load_test3(self): test3 = utils.load_extension('test/data/plugins/test3') assert not hasattr(test3, 'configure') def test_load_test4then3(self): test4 = utils.load_extension('test/data/plugins/test4') ctx = {} try: test4.configure(ctx) except ValueError, e: eq_('Intentional', str(e)) test3 = utils.load_extension('test/data/plugins/test3') assert not hasattr(test3, 'configure') def test_load_without_init(self): try: os.remove('test/data/plugins/test5/__init__.py') os.remove('test/data/plugins/test5/__init__.pyc') except IOError: pass utils.load_extension('test/data/plugins/test5') assert os.path.exists('test/data/plugins/test5/__init__.py') class TestProcessExtensions(object): def test_process_extension(self): process = Dingus()
def test_load_test1(self): test1 = utils.load_extension('test/data/plugins/test1') res = test1.service_environment({}) eq_('1234', res['TEST_ENV'])
import os import os.path import tempfile import shutil import json from nose.tools import eq_ from nose.tools import with_setup from build_pack_utils import utils from build_pack_utils import BuildPack newrelic = utils.load_extension('extensions/newrelic') class TestNewRelic(object): def setUp(self): self.build_dir = tempfile.mkdtemp('build-') self.php_dir = os.path.join(self.build_dir, 'php', 'etc') os.makedirs(self.php_dir) shutil.copy('defaults/config/php/5.4.x/php.ini', self.php_dir) def tearDown(self): if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir) def testDefaults(self): nr = newrelic.NewRelicInstaller( utils.FormattedDict({'BUILD_DIR': self.build_dir})) eq_(True, 'NEWRELIC_HOST' in nr._ctx.keys()) eq_(True, 'NEWRELIC_VERSION' in nr._ctx.keys()) eq_(True, 'NEWRELIC_PACKAGE' in nr._ctx.keys()) eq_(True, 'NEWRELIC_DOWNLOAD_URL' in nr._ctx.keys())
def __init__(self): self.extension_module = utils.load_extension('extensions/composer')
def __init__(self): self.extension_module = utils.load_extension('extensions/geoip')
import os import os.path import tempfile import shutil import json from nose.tools import eq_ from nose.tools import with_setup from build_pack_utils import utils from build_pack_utils import BuildPack newrelic = utils.load_extension('extensions/newrelic') class TestNewRelic(object): def setUp(self): self.build_dir = tempfile.mkdtemp('build-') self.php_dir = os.path.join(self.build_dir, 'php', 'etc') os.makedirs(self.php_dir) shutil.copy('defaults/config/php/5.4.x/php.ini', self.php_dir) def tearDown(self): if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir) def testDefaults(self): nr = newrelic.NewRelicInstaller(utils.FormattedDict({ 'BUILD_DIR': self.build_dir })) eq_(True, 'NEWRELIC_HOST' in nr._ctx.keys()) eq_(True, 'NEWRELIC_VERSION' in nr._ctx.keys())
def test_load_test3(self): test3 = utils.load_extension('test/data/plugins/test3') assert not hasattr(test3, 'configure')
from build_pack_utils import utils extn = utils.load_extension('lib/additional_commands') class TestAdditionalCommandsExtension(object): def test_no_additional_commands(self): ctx = {} tmp = extn.preprocess_commands(ctx) assert tmp == [] def test_one_command_as_string(self): ctx = {'ADDITIONAL_PREPROCESS_CMDS': 'env'} tmp = extn.preprocess_commands(ctx) assert len(tmp) == 1 assert tmp[0] == ['env'] def test_one_additional_command(self): ctx = {'ADDITIONAL_PREPROCESS_CMDS': ['env']} tmp = extn.preprocess_commands(ctx) assert len(tmp) == 1 assert tmp[0] == ['env'] def test_two_additional_commands(self): ctx = {'ADDITIONAL_PREPROCESS_CMDS': ['env', 'run_something']} tmp = extn.preprocess_commands(ctx) assert len(tmp) == 2 assert tmp[0] == ['env'] assert tmp[1] == ['run_something'] def test_command_with_arguments_as_string(self):
def __init__(self): self.extension_module = utils.load_extension('extensions/sessions')
def __init__(self): self.ct = utils.load_extension('extensions/composer')
from build_pack_utils import utils extn = utils.load_extension('lib/additional_commands') class TestAdditionalCommandsExtension(object): def test_no_additional_commands(self): ctx = {} tmp = extn.preprocess_commands(ctx) assert tmp == [] def test_one_command_as_string(self): ctx = { 'ADDITIONAL_PREPROCESS_CMDS': 'env' } tmp = extn.preprocess_commands(ctx) assert len(tmp) == 1 assert tmp[0] == ['env'] def test_one_additional_command(self): ctx = { 'ADDITIONAL_PREPROCESS_CMDS': ['env'] } tmp = extn.preprocess_commands(ctx) assert len(tmp) == 1 assert tmp[0] == ['env'] def test_two_additional_commands(self): ctx = { 'ADDITIONAL_PREPROCESS_CMDS': ['env', 'run_something']
import json from nose.tools import eq_ from nose.tools import with_setup from build_pack_utils import utils from common.integration import ErrorHelper from common.components import BuildPackAssertHelper from common.components import HttpdAssertHelper from common.components import PhpAssertHelper from common.components import NoWebServerAssertHelper from common.components import AppDynamicsAssertHelper from common.components import HhvmAssertHelper from common.components import DownloadAssertHelper from common.base import BaseCompileApp appdynamics = utils.load_extension('extensions/appdynamics') class TestAppDynamics(object): def setUp(self): self.build_dir = tempfile.mkdtemp('build-') self.php_dir = os.path.join(self.build_dir, 'php', 'etc') os.makedirs(self.php_dir) shutil.copy('defaults/config/php/5.5.x/php.ini', self.php_dir) def tearDown(self): if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir) def testDefaults(self): ad = appdynamics.AppDynamicsInstaller(utils.FormattedDict({
import json from nose.tools import eq_ from nose.tools import with_setup from build_pack_utils import utils from common.integration import ErrorHelper from common.components import BuildPackAssertHelper from common.components import HttpdAssertHelper from common.components import PhpAssertHelper from common.components import NoWebServerAssertHelper from common.components import NewRelicAssertHelper from common.components import HhvmAssertHelper from common.components import DownloadAssertHelper from common.base import BaseCompileApp newrelic = utils.load_extension("extensions/newrelic") class TestNewRelic(object): def setUp(self): self.build_dir = tempfile.mkdtemp("build-") self.php_dir = os.path.join(self.build_dir, "php", "etc") os.makedirs(self.php_dir) shutil.copy("defaults/config/php/5.4.x/php.ini", self.php_dir) def tearDown(self): if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir) def testDefaults(self): nr = newrelic.NewRelicInstaller(utils.FormattedDict({"BUILD_DIR": self.build_dir, "PHP_VM": "php"}))