Browse Source

changes after linting

pull/1/head
Holger Frey 5 years ago
parent
commit
fe31bb02ab
  1. 4
      superx_budget/helpers.py
  2. 2
      superx_budget/pyramid/__init__.py
  3. 10
      superx_budget/pyramid/security.py
  4. 14
      tests/test_superx_parser.py

4
superx_budget/helpers.py

@ -4,9 +4,7 @@ from pathlib import Path @@ -4,9 +4,7 @@ from pathlib import Path
import openpyxl
DEFAULT_RECIPIENTS = [
"frey@imtek.de",
]
DEFAULT_RECIPIENTS = ["frey@imtek.de"]
def excel_value_as_number(value):

2
superx_budget/pyramid/__init__.py

@ -34,7 +34,7 @@ def main(global_config, **settings): @@ -34,7 +34,7 @@ def main(global_config, **settings):
config.set_root_factory(Root)
config.add_request_method(
lambda r: Path(settings["budgets.dir"]), "budgets_dir", reify=True,
lambda r: Path(settings["budgets.dir"]), "budgets_dir", reify=True
)
age = int(settings.get("static_views.cache_max_age", 0))

10
superx_budget/pyramid/security.py

@ -21,9 +21,7 @@ def get_user(request): @@ -21,9 +21,7 @@ def get_user(request):
return request.unauthenticated_userid
@forbidden_view_config(
renderer="superx_budget:pyramid/templates/login.jinja2",
)
@forbidden_view_config(renderer="superx_budget:pyramid/templates/login.jinja2")
def forbidden_view(request):
return {"error": False}
@ -42,9 +40,7 @@ def login(request): @@ -42,9 +40,7 @@ def login(request):
return {"error": True}
@view_config(
context=Root, name="logout", permission="login",
)
@view_config(context=Root, name="logout", permission="login")
def logout(request):
headers = forget(request)
return HTTPFound("/", headers=headers)
@ -53,7 +49,7 @@ def logout(request): @@ -53,7 +49,7 @@ def logout(request):
def includeme(config):
settings = config.get_settings()
authn_policy = MyAuthenticationPolicy(
settings["auth.secret"], hashalg="sha512",
settings["auth.secret"], hashalg="sha512"
)
config.set_authentication_policy(authn_policy)
config.set_authorization_policy(ACLAuthorizationPolicy())

14
tests/test_superx_parser.py

@ -51,12 +51,7 @@ def test_get_export_metadata_raises_error(faulty_data): @@ -51,12 +51,7 @@ def test_get_export_metadata_raises_error(faulty_data):
def test_skip_export_data_until_table_header_ok():
from superx_budget.superx import _skip_export_data_until_table_header
rows = [
[""],
[""],
["Kostenstelle"],
["Daten"],
]
rows = [[""], [""], ["Kostenstelle"], ["Daten"]]
iterator = iter(rows)
_skip_export_data_until_table_header(iterator)
data_line = next(iterator)
@ -68,12 +63,7 @@ def test_skip_export_data_until_table_header_raises_error(): @@ -68,12 +63,7 @@ def test_skip_export_data_until_table_header_raises_error():
from superx_budget.superx import _skip_export_data_until_table_header
from superx_budget.exceptions import SuperXParserError
rows = [
[""],
[""],
["Keine Kostenstelle"],
["Daten"],
]
rows = [[""], [""], ["Keine Kostenstelle"], ["Daten"]]
iterator = iter(rows)
with pytest.raises(SuperXParserError):
_skip_export_data_until_table_header(iterator)

Loading…
Cancel
Save