Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise test framework auto topup bunq/sdk_python#78 #81

Merged
merged 19 commits into from
Apr 12, 2018

Conversation

OGKevin
Copy link
Contributor

@OGKevin OGKevin commented Apr 5, 2018

This PR closes/fixes the following issues:

must be merged after #80

@OGKevin OGKevin added this to the 0.13.5 milestone Apr 5, 2018
@OGKevin OGKevin self-assigned this Apr 5, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
@bunq bunq deleted a comment Apr 6, 2018
Copy link
Contributor Author

@OGKevin OGKevin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes.

"""
:type _second_monetary_account: endpoint.MonetaryAccountBank
:type _cash_register: endpoint.CashRegister

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new line can go

@OGKevin
Copy link
Contributor Author

OGKevin commented Apr 6, 2018

@JordyHeemskerk please 👀

@bunq bunq deleted a comment Apr 6, 2018
bunq/sdk/util.py Outdated
:rtype: endpoint.SandboxUser
"""

url = "https://sandbox.public.api.bunq.com/v1/sandbox-user"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use: ApiEnvironmentType.SANDBOX.uri_base instead of https://sandbox.public.api.bunq.com/v1/

bunq/sdk/util.py Outdated
url = "https://sandbox.public.api.bunq.com/v1/sandbox-user"

headers = {
'x-bunq-client-request-id': "uniqueness-is-required",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ApiClient.HEADER_ for this, and then extract the values as wel

bunq/sdk/util.py Outdated

import requests

from bunq.sdk.context import ApiContext, ApiEnvironmentType

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate imports

bunq/sdk/util.py Outdated
'x-bunq-region': "en_US",
}

response = requests.request("POST", url, headers=headers)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constant.

bunq/sdk/util.py Outdated

response = requests.request("POST", url, headers=headers)

if response.status_code is 200:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constant.


def __set_second_monetary_account(self):
response = endpoint.MonetaryAccountBank.create(
'EUR',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constants.

Catches BunqException if the conf file does not exist.
def __request_spending_money(self):
endpoint.RequestInquiry.create(
object_.Amount('500', 'EUR'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constants.

endpoint.RequestInquiry.create(
object_.Amount('500', 'EUR'),
object_.Pointer('EMAIL', 'sugardaddy@bunq.com'),
'sdk python test, thanks daddy <3 - OG',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double space between sdk and python, also remove - OG to keep in line with PHP.

:rtype: context.ApiContext
"""

filename_bunq_config_full = (cls._get_directory_test_root() +
cls._FILENAME_BUNQ_CONFIG)
util.automatic_sandbox_install('bunq-test.conf')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constant.

cls._DEVICE_DESCRIPTION, [])
else:
api_context.ensure_session_active()
return object_.Pointer('EMAIL', 'bravo@bunq.com')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract constant.

@bunq bunq deleted a comment Apr 6, 2018
Copy link

@JordyHeemskerk JordyHeemskerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OGKevin OGKevin merged commit 15237f6 into develop Apr 12, 2018
@OGKevin OGKevin deleted the optimise_test_framework_auto_topup_bunq/sdk_python#78 branch April 12, 2018 15:18
@OGKevin
Copy link
Contributor Author

OGKevin commented Apr 12, 2018

@andrederoos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimise test framework
2 participants