Exemple #1
0
 def handle_get(self, api, command):
     key = command.get("key")
     if key is None:
         return self.reply(command, success=False)
     conversation = self.app_worker.conversation_for_api(api)
     value = jsbox_config_value(conversation.config, key)
     return self.reply(command, value=value, success=True)
Exemple #2
0
 def handle_get(self, api, command):
     key = command.get("key")
     if key is None:
         return self.reply(command, success=False)
     conversation = self.app_worker.conversation_for_api(api)
     value = jsbox_config_value(conversation.config, key)
     return self.reply(command, value=value, success=True)
Exemple #3
0
 def get_jsbox_js_config(self, conv):
     try:
         return jsbox_js_config(conv.config)
     except Exception:
         log.err("Bad jsbox js config: %s" %
                 (jsbox_config_value(conv.config, 'config'), ))
         return
Exemple #4
0
 def get_jsbox_js_config(self, conv):
     try:
         return jsbox_js_config(conv.config)
     except Exception:
         log.err(
             "Bad jsbox js config: %s"
             % (jsbox_config_value(conv.config, 'config'),))
         return
Exemple #5
0
    def test_jsbox_config_value(self):
        config = {
            'jsbox_app_config': {
                'foo': {
                    'key': 'foo',
                    'value': 'bar'
                }
            }
        }

        self.assertEqual(utils.jsbox_config_value(config, 'foo'), 'bar')
Exemple #6
0
    def test_jsbox_config_value(self):
        config = {'jsbox_app_config': {'foo': {'key': 'foo', 'value': 'bar'}}}

        self.assertEqual(utils.jsbox_config_value(config, 'foo'), 'bar')
Exemple #7
0
 def test_jsbox_config_value_no_config(self):
     self.assertEqual(utils.jsbox_config_value({}, 'foo'), None)
Exemple #8
0
    def test_jsbox_config_value_no_value(self):
        config = {'jsbox_app_config': {}}

        self.assertEqual(utils.jsbox_config_value(config, 'foo'), None)
Exemple #9
0
 def test_jsbox_config_value_no_config(self):
     self.assertEqual(utils.jsbox_config_value({}, 'foo'), None)
Exemple #10
0
    def test_jsbox_config_value_no_value(self):
        config = {
            'jsbox_app_config': {}
        }

        self.assertEqual(utils.jsbox_config_value(config, 'foo'), None)