Skip to content

Commit

Permalink
Test why tests are not working
Browse files Browse the repository at this point in the history
  • Loading branch information
PSzczepanski1996 committed Jan 22, 2024
1 parent 9ee9ade commit ffa9bf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions tpay_module/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_create_transaction_when_failure(self):
{'error': _('Return URL of TPay must be set in settings')},
)

@patch('requests.post')
@patch('requests.get')
def test_get_transaction_simply(self, mock):
"""Test get transaction by simple way."""
mock.return_value = Mock(
Expand All @@ -118,7 +118,7 @@ def test_get_transaction_simply(self, mock):
result = self.module.get_transaction('123')
self.assertEqual(result, {'access_token': self.bearer_token})

@patch('requests.post')
@patch('requests.get')
def test_get_transaction_with_exception(self, mock):
"""Test get transaction by raising empty data."""
mock.return_value = Mock(
Expand Down
14 changes: 5 additions & 9 deletions tpay_module/tpay_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,11 @@ def pay_by_saved_card(self, transaction_id, card_token):

def get_transaction(self, transaction_id):
"""Get certain transaction via transactionId field."""
try:
response_data = requests.get(
f'{self.api_url}/transactions/{transaction_id}',
json={}, headers=self.get_headers(),
).json()
return response_data
except BaseException:
pass
return {}
response_data = requests.get(
f'{self.api_url}/transactions/{transaction_id}',
json={}, headers=self.get_headers(),
).json()
return response_data

def get_all_transactions(self, limit=None, from_dt=None, to_dt=None):
"""FOR NOW dummy method to get list of all transactions."""
Expand Down

0 comments on commit ffa9bf1

Please sign in to comment.