1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-23 10:02:21 +00:00

PEP8 compliance

This commit is contained in:
J. Fernando Sánchez
2014-11-20 19:29:49 +01:00
parent eaf65f0c6b
commit 2b68838514
14 changed files with 117 additions and 130 deletions

View File

@@ -0,0 +1 @@

View File

@@ -1,5 +1,7 @@
import os
import logging
try:
import unittest.mock as mock
except ImportError:
@@ -8,10 +10,12 @@ from senpy.extensions import Senpy
from flask import Flask
from flask.ext.testing import TestCase
def check_dict(indic, template):
return all(item in indic.items() for item in template.items())
class Blueprints_Test(TestCase):
def check_dict(indic, template):
return all(item in indic.items() for item in template.items())
class BlueprintsTest(TestCase):
def create_app(self):
self.app = Flask("test_extensions")
self.senpy = Senpy()
@@ -20,7 +24,6 @@ class Blueprints_Test(TestCase):
self.senpy.add_folder(self.dir)
return self.app
def test_home(self):
""" Calling with no arguments should ask the user for more arguments """
resp = self.client.get("/")

View File

@@ -1,5 +1,6 @@
import os
import logging
try:
import unittest.mock as mock
except ImportError:
@@ -9,7 +10,7 @@ from flask import Flask
from flask.ext.testing import TestCase
class Extensions_Test(TestCase):
class ExtensionsTest(TestCase):
def create_app(self):
self.app = Flask("test_extensions")
self.senpy = Senpy()
@@ -22,16 +23,16 @@ class Extensions_Test(TestCase):
""" Initialising the app with the extension. """
assert hasattr(self.app, "senpy")
tapp = Flask("temp app")
tsen = Senpy(tapp)
self.senpy.init_app(tapp)
assert hasattr(tapp, "senpy")
def test_discovery(self):
""" Discovery of plugins in given folders. """
# noinspection PyProtectedMember
assert self.dir in self.senpy._search_folders
print self.senpy.plugins
assert "dummy" in self.senpy.plugins
def test_enabling(self):
""" Enabling a plugin """
self.senpy.enable_plugin("dummy")
@@ -41,7 +42,7 @@ class Extensions_Test(TestCase):
""" Disabling a plugin """
self.senpy.enable_plugin("dummy")
self.senpy.disable_plugin("dummy")
assert self.senpy.plugins["dummy"].enabled == False
assert not self.senpy.plugins["dummy"].enabled
def test_default(self):
""" Default plugin should be set """
@@ -63,7 +64,7 @@ class Extensions_Test(TestCase):
def test_filtering(self):
""" Filtering plugins """
assert len(self.senpy.filter_plugins(name="dummy"))>0
assert len(self.senpy.filter_plugins(name="dummy")) > 0
assert not len(self.senpy.filter_plugins(name="notdummy"))
assert self.senpy.filter_plugins(name="dummy", enabled=True)
self.senpy.disable_plugin("dummy")