Esempio n. 1
0
 def setUp(self):
     nodejs_executable = find_nodejs_or_skip_test(JsSandbox)
     sandboxer_js = pkg_resources.resource_filename('vumi.application',
                                                    'sandboxer.js')
     self.app_helper = self.add_helper(AppWorkerHelper(JsBoxApplication))
     self.app = yield self.app_helper.get_app_worker({
         'executable': nodejs_executable,
         'args': [sandboxer_js],
         'timeout': 10,
     })
Esempio n. 2
0
 def setUp(self):
     nodejs_executable = find_nodejs_or_skip_test(JsSandbox)
     sandboxer_js = pkg_resources.resource_filename('vumi.application',
                                                    'sandboxer.js')
     self.app_helper = self.add_helper(AppWorkerHelper(JsBoxApplication))
     self.app = yield self.app_helper.get_app_worker({
         'executable': nodejs_executable,
         'args': [sandboxer_js],
         'timeout': 10,
     })
Esempio n. 3
0
    def setUp(self):
        nodejs_executable = find_nodejs_or_skip_test(DialogueApplication)

        self.app_helper = self.add_helper(AppWorkerHelper(DialogueApplication))

        sandboxer_js = pkg_resources.resource_filename('vumi.application',
                                                       'sandboxer.js')
        node_path = os.environ['SANDBOX_NODE_PATH']  # Required to run tests.
        redis = yield self.app_helper.vumi_helper.get_redis_manager()
        self.kv_redis = redis.sub_manager('kv')
        self.app = yield self.app_helper.get_app_worker({
            'executable':
            nodejs_executable,
            'args': [sandboxer_js],
            'timeout':
            10,
            'app_context':
            ("{require: function(m) {"
             " if (['moment', 'url', 'querystring', 'crypto', 'lodash',"
             " 'q', 'jed', 'libxmljs', 'zlib', 'vumigo_v01', 'vumigo_v02'"
             "].indexOf(m) >= 0) return require(m); return null;"
             " }, Buffer: Buffer}"),
            'env': {
                'NODE_PATH': node_path,
            },
            'sandbox': {
                'config': {
                    'cls': 'go.apps.dialogue.vumi_app.PollConfigResource',
                },
                'contacts': {
                    'cls': 'go.apps.jsbox.contacts.ContactsResource',
                },
                'kv': {
                    'cls': 'vumi.application.sandbox.RedisResource',
                    'redis_manager': {
                        'FAKE_REDIS': self.kv_redis
                    },
                },
                'outbound': {
                    'cls': 'go.apps.jsbox.outbound.GoOutboundResource',
                },
            },
        })
Esempio n. 4
0
    def setUp(self):
        nodejs_executable = find_nodejs_or_skip_test(DialogueApplication)

        self.app_helper = self.add_helper(AppWorkerHelper(DialogueApplication))

        sandboxer_js = pkg_resources.resource_filename('vumi.application',
                                                       'sandboxer.js')
        node_path = os.environ['SANDBOX_NODE_PATH']  # Required to run tests.
        redis = yield self.app_helper.vumi_helper.get_redis_manager()
        self.kv_redis = redis.sub_manager('kv')
        self.app = yield self.app_helper.get_app_worker({
            'executable': nodejs_executable,
            'args': [sandboxer_js],
            'timeout': 10,
            'app_context': (
                "{require: function(m) {"
                " if (['moment', 'url', 'querystring', 'crypto', 'lodash',"
                " 'q', 'jed', 'libxmljs', 'zlib', 'vumigo_v01', 'vumigo_v02'"
                "].indexOf(m) >= 0) return require(m); return null;"
                " }, Buffer: Buffer}"
            ),
            'env': {
                'NODE_PATH': node_path,
            },
            'sandbox': {
                'config': {
                    'cls': 'go.apps.dialogue.vumi_app.PollConfigResource',
                },
                'contacts': {
                    'cls': 'go.apps.jsbox.contacts.ContactsResource',
                },
                'kv': {
                    'cls': 'vumi.application.sandbox.RedisResource',
                    'redis_manager': {'FAKE_REDIS': self.kv_redis},
                },
                'outbound': {
                    'cls': 'go.apps.jsbox.outbound.GoOutboundResource',
                },
            },
        })