Exemplo n.º 1
0
    def test_get_settings(self):
        context = ExecutionContext(user=self.plugin_info['1']['user'], plugin=self.plugin_info['1']['plugin'])
        manager = PluginManager(context)

        # Should return the response from the view.
        response = manager.get_settings(self.plugin_info['1']['plugin'].hashkey)
        self.assertTrue(isinstance(response, dict))
Exemplo n.º 2
0
    def test_get_route(self):
        context = ExecutionContext(user=self.plugin_info['1']['user'], plugin=self.plugin_info['1']['plugin'])
        login_user(self.plugin_info['1']['user'])
        manager = PluginManager(context)
        response = manager.call_route_handler(self.plugin_info['1']['views']['test'].hashkey, "get", {}, None)
        logout_user()

        self.assertEqual(response.status_code, 200)
Exemplo n.º 3
0
    def test_get_settings(self):
        context = ExecutionContext(user=self.plugin_info['1']['user'],
                                   plugin=self.plugin_info['1']['plugin'])
        manager = PluginManager(context)

        # Should return the response from the view.
        response = manager.get_settings(
            self.plugin_info['1']['plugin'].hashkey)
        self.assertTrue(isinstance(response, dict))
Exemplo n.º 4
0
    def test_get_route(self):
        context = ExecutionContext(user=self.plugin_info['1']['user'],
                                   plugin=self.plugin_info['1']['plugin'])
        login_user(self.plugin_info['1']['user'])
        manager = PluginManager(context)
        response = manager.call_route_handler(
            self.plugin_info['1']['views']['test'].hashkey, "get", {}, None)
        logout_user()

        self.assertEqual(response.status_code, 200)
Exemplo n.º 5
0
    def test_404_plugin(self):

        simple = {'status': '404'}
        plugin_manager = PluginManager()
        plugin_manager.call_method(method='process', args=simple)

        for item in plugin_manager.plugins:
            if isinstance(item, CountHTTP404):
                self.assertEquals(1, item.counter_total)
                self.assertEquals(1, item.counter_404)
    def test_404_plugin(self):

        simple = { 'status':'404' }
        plugin_manager = PluginManager()
        plugin_manager.call_method(method='process', args = simple)

        for item in plugin_manager.plugins:
            if isinstance(item, CountHTTP404):
                self.assertEquals(1, item.counter_total)
                self.assertEquals(1, item.counter_404)
Exemplo n.º 7
0
    def test_plugin(self):
        # test the combined example from apache.org
        #self.combined_log_entry = '127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"'
        simple = {'status': '200'}
        plugin_manager = PluginManager()
        plugin_manager.call_method(method='process', args=simple)

        for item in plugin_manager.plugins:
            if isinstance(item, CountHTTP200):
                self.assertEquals(1, item.counter_total)
                self.assertEquals(1, item.counter_200)
    def test_plugin(self):
        # test the combined example from apache.org
        #self.combined_log_entry = '127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"'
        simple = { 'status':'200' }
        plugin_manager = PluginManager()
        plugin_manager.call_method(method='process', args = simple)

        for item in plugin_manager.plugins:
            if isinstance(item, CountHTTP200):
                self.assertEquals (1, item.counter_total)
                self.assertEquals (1, item.counter_200)
Exemplo n.º 9
0
    def test_add_remove(self):
        user = UserFactory()
        context = ExecutionContext(user=user, plugin=self.plugin_info['1']['plugin'])
        manager = PluginManager(context)

        # This should be 1 because we have just added a plugin for the user.
        plugin_key = self.plugin_info['1']['plugin'].hashkey
        manager.add(plugin_key)
        self.assertEqual(len(user.plugins), 1)

        manager.remove(plugin_key)
        self.assertEqual(len(user.plugins), 0)
Exemplo n.º 10
0
    def test_add_remove(self):
        user = UserFactory()
        context = ExecutionContext(user=user,
                                   plugin=self.plugin_info['1']['plugin'])
        manager = PluginManager(context)

        # This should be 1 because we have just added a plugin for the user.
        plugin_key = self.plugin_info['1']['plugin'].hashkey
        manager.add(plugin_key)
        self.assertEqual(len(user.plugins), 1)

        manager.remove(plugin_key)
        self.assertEqual(len(user.plugins), 0)
Exemplo n.º 11
0
# coding:utf-8
"""
Created on 15.10.13

@author: kasimova
"""
__version__ = "1.0.0"
import os
from django.conf import settings as settings_pr

from settings import parser
from helpers import import_class
from manager import PluginManager

PlManager = PluginManager()
PlManager.locator = import_class(parser.get("DEFAULT", "PLUGIN_LOCATOR"))()
PlManager.validator = import_class(parser.get("DEFAULT", "PLUGIN_VALIDATOR"))()
PlManager.storage = import_class(parser.get("DEFAULT", "PLUGIN_STORAGE"))()
PlManager.installer = import_class(parser.get("DEFAULT", "PLUGIN_INSTALLER"))()
PlManager.installer.install_dir = parser.get("DEFAULT", "PATH_TO_INSTALL")

plugins = map(lambda x: "%s.%s" % (os.path.basename(PlManager.installer.install_dir), x), PlManager.get_plugins())

settings_pr.INSTALLED_APPS += tuple(plugins)
def main():
    plugin_manager = PluginManager()
    log_generator = LogLineGenerator()
    for log_line in log_generator.get_loglines():
        plugin_manager.call_method('process', args=log_line)
    plugin_manager.call_method('report')
Exemplo n.º 13
0
def main():
    plugin_manager = PluginManager()
    log_generator = LogLineGenerator()
    for log_line in log_generator.get_loglines():
        plugin_manager.call_method('process', args=log_line)
    plugin_manager.call_method('report')
Exemplo n.º 14
0
#  Copyright (c) 2018 Sony Pictures Imageworks Inc.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

import os

from manager import PluginManager

PluginManager.load_all_plugins()