コード例 #1
0
    def setupUnsupportedBuilder(self):
        package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'pokemongo_bot', 'test', 'resources', 'plugin_fixture')
        plugin_loader = PluginLoader()
        plugin_loader.load_plugin(package_path)

        obj = convert_from_json("""[{
            "type": "plugin_fixture.UnsupportedApiTask"
        }]""")

        return TreeConfigBuilder(self.bot, obj)
コード例 #2
0
    def setupUnsupportedBuilder(self):
        package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                    '..', 'pokemongo_bot', 'test', 'resources',
                                    'plugin_fixture')
        plugin_loader = PluginLoader()
        plugin_loader.load_plugin(package_path)

        obj = convert_from_json("""[{
            "type": "plugin_fixture.UnsupportedApiTask"
        }]""")

        return TreeConfigBuilder(self.bot, obj)
コード例 #3
0
    def test_load_plugin_task(self):
        package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'resources', 'plugin_fixture')
        plugin_loader = PluginLoader()
        plugin_loader.load_plugin(package_path)

        obj = convert_from_json("""[{
            "type": "plugin_fixture.FakeTask"
        }]""")

        builder = TreeConfigBuilder(self.bot, obj)
        tree = builder.build()
        result = tree[0].work()
        self.assertEqual(result, 'FakeTask')
コード例 #4
0
    def test_load_plugin_task(self):
        package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                    'resources', 'plugin_fixture')
        plugin_loader = PluginLoader()
        plugin_loader.load_plugin(package_path)

        obj = convert_from_json("""[{
            "type": "plugin_fixture.FakeTask"
        }]""")

        builder = TreeConfigBuilder(self.bot, obj)
        tree = builder.build()
        result = tree[0].work()
        self.assertEqual(result, 'FakeTask')