예제 #1
0
    def test_basic_conf(self):

        settings.WIRECLOUD_PLUGINS = ()

        core_plugins = len(get_plugins())
        core_features = len(get_active_features())
        core_classic_javascripts = len(get_extra_javascripts('classic'))
        core_smartphone_javascripts = len(get_extra_javascripts('smartphone'))
        core_classic_extensions = len(get_widget_api_extensions('classic', {}))
        core_smartphone_extensions = len(
            get_widget_api_extensions('smartphone', {}))

        settings.WIRECLOUD_PLUGINS = (
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin1',
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin2',
        )
        clear_cache()

        self.assertEqual(len(get_plugins()), core_plugins + 2)
        self.assertEqual(len(get_active_features()), core_features + 2)
        self.assertEqual(len(get_extra_javascripts('classic')),
                         core_classic_javascripts + 2)
        self.assertEqual(len(get_extra_javascripts('smartphone')),
                         core_smartphone_javascripts + 1)
        self.assertEqual(len(get_widget_api_extensions('classic', {})),
                         core_classic_extensions + 1)
        self.assertEqual(len(get_widget_api_extensions('smartphone', {})),
                         core_smartphone_extensions + 0)
예제 #2
0
파일: views.py 프로젝트: fispace/wirecloud
    def read(self, request):
        info = get_active_features()
        features = {}
        for feature_name in info:
            features[feature_name] = info[feature_name]['version']

        return HttpResponse(json.dumps(features), mimetype='application/json; charset=UTF-8')
예제 #3
0
def check_requirements(resource):

    active_features = get_active_features()

    for requirement in resource['requirements']:
        if requirement['type'] == 'feature':

            if requirement['name'] not in active_features:
                raise UnsupportedFeature('Required feature (%s) is not enabled for this WireCloud installation.' % requirement['name'])

        else:

            raise UnsupportedFeature('Unsupported requirement type (%s).' % requirement['type'])
예제 #4
0
def check_requirements(resource):

    active_features = get_active_features()

    for requirement in resource['requirements']:
        if requirement['type'] == 'feature':

            if requirement['name'] not in active_features:
                raise UnsupportedFeature('Required feature (%s) is not enabled for this WireCloud installation.' % requirement['name'])

        else:

            raise UnsupportedFeature('Unsupported requirement type (%s).' % requirement['type'])
예제 #5
0
파일: utils.py 프로젝트: fispace/wirecloud
def check_requirements(resource):

    active_features = get_active_features()

    for requirement in resource['requirements']:
        if requirement['type'] == 'feature':

            if requirement['name'] not in active_features:
                raise Exception('Required feature is not enabled: %s' % requirement['name'])

        else:

            raise Exception('Unsupported requirement type: %s' % requirement['type'])
예제 #6
0
    def test_basic_conf(self):

        settings.WIRECLOUD_PLUGINS = ()

        core_plugins = len(get_plugins())
        core_features = len(get_active_features())
        core_classic_javascripts = len(get_extra_javascripts('classic'))
        core_smartphone_javascripts = len(get_extra_javascripts('smartphone'))
        core_classic_extensions = len(get_widget_api_extensions('classic', {}))
        core_smartphone_extensions = len(get_widget_api_extensions('smartphone', {}))

        settings.WIRECLOUD_PLUGINS = (
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin1',
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin2',
        )
        clear_cache()

        self.assertEqual(len(get_plugins()), core_plugins + 2)
        self.assertEqual(len(get_active_features()), core_features + 2)
        self.assertEqual(len(get_extra_javascripts('classic')), core_classic_javascripts + 2)
        self.assertEqual(len(get_extra_javascripts('smartphone')), core_smartphone_javascripts + 1)
        self.assertEqual(len(get_widget_api_extensions('classic', {})), core_classic_extensions + 1)
        self.assertEqual(len(get_widget_api_extensions('smartphone', {})), core_smartphone_extensions + 0)
예제 #7
0
파일: utils.py 프로젝트: perezdf/wirecloud
def check_requirements(resource):

    active_features = get_active_features()

    for requirement in resource["requirements"]:
        if requirement["type"] == "feature":

            if requirement["name"] not in active_features:
                raise UnsupportedFeature(
                    "Required feature (%s) is not enabled for this WireCloud installation." % requirement["name"]
                )

        else:

            raise UnsupportedFeature("Unsupported requirement type (%s)." % requirement["type"])