-
Notifications
You must be signed in to change notification settings - Fork 26
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
Optimise test framework auto topup bunq/sdk_python#78 #81
Conversation
…test_framework_auto_topup_bunq/sdk_python#78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes.
tests/bunq_test.py
Outdated
""" | ||
:type _second_monetary_account: endpoint.MonetaryAccountBank | ||
:type _cash_register: endpoint.CashRegister | ||
|
There was a problem hiding this comment.
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
@JordyHeemskerk please 👀 |
bunq/sdk/util.py
Outdated
:rtype: endpoint.SandboxUser | ||
""" | ||
|
||
url = "https://sandbox.public.api.bunq.com/v1/sandbox-user" |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract constant.
tests/bunq_test.py
Outdated
|
||
def __set_second_monetary_account(self): | ||
response = endpoint.MonetaryAccountBank.create( | ||
'EUR', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract constants.
tests/bunq_test.py
Outdated
Catches BunqException if the conf file does not exist. | ||
def __request_spending_money(self): | ||
endpoint.RequestInquiry.create( | ||
object_.Amount('500', 'EUR'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract constants.
tests/bunq_test.py
Outdated
endpoint.RequestInquiry.create( | ||
object_.Amount('500', 'EUR'), | ||
object_.Pointer('EMAIL', 'sugardaddy@bunq.com'), | ||
'sdk python test, thanks daddy <3 - OG', |
There was a problem hiding this comment.
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.
tests/bunq_test.py
Outdated
:rtype: context.ApiContext | ||
""" | ||
|
||
filename_bunq_config_full = (cls._get_directory_test_root() + | ||
cls._FILENAME_BUNQ_CONFIG) | ||
util.automatic_sandbox_install('bunq-test.conf') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract constant.
tests/bunq_test.py
Outdated
cls._DEVICE_DESCRIPTION, []) | ||
else: | ||
api_context.ensure_session_active() | ||
return object_.Pointer('EMAIL', 'bravo@bunq.com') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR closes/fixes the following issues:
must be merged after #80