Skip to content

Commit

Permalink
most of pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
Berend Kapelle committed Feb 9, 2018
1 parent 02cddbb commit e6e4897
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
1 change: 0 additions & 1 deletion figo/figo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from figo.models import Notification
from figo.models import Payment
from figo.models import PaymentProposal
from figo.models import ProcessToken
from figo.models import Security
from figo.models import Service
from figo.models import TaskState
Expand Down
15 changes: 7 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
from logging import basicConfig

from figo.credentials import CREDENTIALS
from figo.credentials import DEMO_CREDENTIALS
from figo.credentials import DEMO_TOKEN
from figo import FigoConnection
from figo import FigoSession

basicConfig(level='DEBUG')

PASSWORD = 'some_words'


@pytest.fixture(scope='module')
def new_user_id():
return "{0}[email protected]".format(uuid.uuid4())
Expand Down Expand Up @@ -49,7 +48,7 @@ def figo_session(figo_connection, new_user_id):

session = FigoSession(response['access_token'])

task_token = session.add_account("de", ("figo", "figo"), "90090042" )
task_token = session.add_account("de", ("figo", "figo"), "90090042")
state = session.get_task_state(task_token)

while not (state.is_ended or state.is_erroneous):
Expand All @@ -71,15 +70,15 @@ def account_ids(figo_session):

@pytest.fixture(scope='module')
def giro_account(figo_session):
# returns the first account from the demo bank that is of type "Girokonto" and asserts there is at least one
# returns the first account from the demo bank that is of type "Girokonto"
# and asserts there is at least one
accs = figo_session.accounts

giro_accs = [a for a in accs if a.type=="Giro account"]

giro_accs = [a for a in accs if a.type == "Giro account"]
assert len(giro_accs) >= 1

yield giro_accs[0]


@pytest.fixture(scope='module')
def access_token(figo_connection, new_user_id):
figo_connection.add_user("Test", new_user_id, PASSWORD)
Expand All @@ -89,4 +88,4 @@ def access_token(figo_connection, new_user_id):
yield access_token

session = FigoSession(access_token)
session.remove_user()
session.remove_user()
20 changes: 8 additions & 12 deletions tests/test_catalog_and_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
BANK_CODE = "90090042"
CLIENT_ERROR = 1000


@pytest.mark.parametrize('language', ['de', 'en'])
def test_get_catalog_en(access_token, language):
figo_session = FigoSession(access_token)
Expand All @@ -31,13 +32,6 @@ def test_get_supported_payment_services(access_token):
services = figo_session.get_supported_payment_services("de")
assert len(services) > 10 # this a changing value, this tests that at least some are returned
assert isinstance(services[0], Service)


def test_get_login_settings(access_token):
figo_session = FigoSession(access_token)
login_settings = figo_session.get_login_settings("de", "90090042")
assert login_settings.advice
assert login_settings.credentials


# XXX(Valentin): Catalog needs `accounts=rw`, so it doesn't work with the demo session.
Expand All @@ -47,19 +41,21 @@ def test_get_catalog(access_token):
figo_session = FigoSession(access_token)
catalog = figo_session.get_catalog()
assert len(catalog) == 2


def test_get_login_settings(access_token):
figo_session = FigoSession(access_token)
login_settings = figo_session.get_login_settings("de", BANK_CODE)
assert isinstance(login_settings, LoginSettings)


assert login_settings.advice
assert login_settings.credentials


def test_set_unset_language(access_token):
figo_session = FigoSession(access_token)
assert figo_session.language is None
figo_session.language = 'de'
assert figo_session.language == 'de'
figo_session.language = ''
assert figo_session.language is None
figo_session.language = 'de'
figo_session.language = 'de'

0 comments on commit e6e4897

Please sign in to comment.