Skip to content

Commit 7d02161

Browse files
author
Pascal Wink
committed
add timeouts to prevent timeout and make sure request is accepted
1 parent 3ac41ff commit 7d02161

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ bunq_sdk.egg-info
7979
.idea/codeStyles/
8080
venv
8181

82-
tests/assets/bunq-oauth-psd2-test.conf
83-
tests/assets/bunq-psd2-test.conf
84-
tests/assets/key.pem
85-
tests/assets/certificate.pem
82+
tests/bunq-oauth-psd2-test.conf
83+
tests/bunq-psd2-test.conf
84+
tests/key.pem
85+
tests/certificate.pem
8686

tests/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ common scenarios can run without any errors.
1010

1111
## Installation and Execution
1212

13+
openssl req -x509 -newkey rsa:4096 -keyout tests/key.pem -out tests/certificate.pem -days 365 -nodes -subj "/CN=adsadsahjksbhjbdjhasds/C=NL" && \
14+
echo -e "\n--- KEY ---\n" && cat tests/key.pem && \
15+
echo -e "\n--- CERTIFICATE ---\n" && cat tests/certificate.pem
16+
17+
1318
You can install all the required dependencies with the following command:
1419

1520
python3 setup.py install

tests/bunq_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BunqSdkTestCase(unittest.TestCase):
4343

4444
_EMAIL_BRAVO = 'bravo@bunq.com'
4545

46-
__TIME_OUT_AUTO_ACCEPT_SPENDING_MONEY = 0.5
46+
__TIME_OUT_AUTO_ACCEPT_SPENDING_MONEY = 2
4747

4848
_second_monetary_account = None
4949

tests/context/test_psd2_context.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class TestPsd2Context(unittest.TestCase):
1414
Psd2Context
1515
"""
1616

17-
_FILE_TEST_CONFIGURATION = '/assets/bunq-psd2-test.conf'
18-
_FILE_TEST_OAUTH = '/assets/bunq-oauth-psd2-test.conf'
17+
_FILE_TEST_CONFIGURATION = '/bunq-psd2-test.conf'
18+
_FILE_TEST_OAUTH = '/bunq-oauth-psd2-test.conf'
1919

20-
_FILE_TEST_CERTIFICATE = '/assets/certificate.pem'
21-
_FILE_TEST_CERTIFICATE_CHAIN = '/assets/certificate.pem'
22-
_FILE_TEST_PRIVATE_KEY = '/assets/key.pem'
20+
_FILE_TEST_CERTIFICATE = '/certificate.pem'
21+
_FILE_TEST_CERTIFICATE_CHAIN = '/certificate.pem'
22+
_FILE_TEST_PRIVATE_KEY = '/key.pem'
2323

2424
_TEST_DEVICE_DESCRIPTION = 'PSD2TestDevice'
2525

@@ -72,8 +72,8 @@ def test_create_oauth_client(self) -> None:
7272
return
7373

7474
try:
75-
client_id = OauthClient.create().value
76-
oauth_client = OauthClient.get(client_id).value
75+
client_id = OauthClientApiObject.create().value
76+
oauth_client = OauthClientApiObject.get(client_id).value
7777

7878
self.assertIsNotNone(oauth_client)
7979

tests/http/test_pagination_scenario.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import time
12
from typing import List, Dict
23

34
from bunq import Pagination
@@ -15,6 +16,8 @@ class TestPaginationScenario(BunqSdkTestCase):
1516
Pagination
1617
"""
1718

19+
__TIME_OUT_PREVENT_RATE_LIMIT = 2
20+
1821
@classmethod
1922
def setUpClass(cls):
2023
cls._PAYMENT_LISTING_PAGE_SIZE = 2
@@ -31,10 +34,15 @@ def test_api_scenario_payment_listing_with_pagination(self):
3134
payments_expected = self._payments_required()
3235
pagination = Pagination()
3336
pagination.count = self._PAYMENT_LISTING_PAGE_SIZE
37+
38+
time.sleep(self.__TIME_OUT_PREVENT_RATE_LIMIT)
3439
response_latest = self._list_payments(pagination.url_params_count_only)
3540
pagination_latest = response_latest.pagination
41+
42+
time.sleep(self.__TIME_OUT_PREVENT_RATE_LIMIT)
3643
response_previous = self._list_payments(pagination_latest.url_params_previous_page)
3744
pagination_previous = response_previous.pagination
45+
3846
response_previous_next = self._list_payments(pagination_previous.url_params_next_page)
3947
payments_previous = response_previous.value
4048
payments_previous_next = response_previous_next.value

0 commit comments

Comments
 (0)