Skip to content

Commit

Permalink
integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiseun committed Nov 30, 2023
1 parent a19a4a0 commit 056bcaf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 13 additions & 0 deletions integration_tests/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pinterest.organic.boards import Board
from pinterest.client import PinterestSDKClient
from integration_tests.base_test import BaseTestCase
from pinterest.utils.error_handling import SdkException


class ClientTest(BaseTestCase):
Expand Down Expand Up @@ -56,6 +57,18 @@ def test_good_setup_default_access_token(self):
PinterestSDKClient.set_default_access_token(access_token=good_access_token)
self.assertIsNotNone(Board.get_all())

def test_bad_refresh_token(self):
refresh_token = 'refresh_token'
app_id = '12345'
app_secret = '123456asdfg'
with self.assertRaises(SdkException):
PinterestSDKClient._get_access_token(
refresh_token=refresh_token,
app_id=app_id,
app_secret=app_secret
)





Expand Down
7 changes: 2 additions & 5 deletions tests/src/pinterest/client/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,10 @@ def test_set_bad_refresh_token(self, load_dotenv_mock):
self.assertNotEqual(refresh_token, PINTEREST_REFRESH_ACCESS_TOKEN)
self.assertNotEqual(app_id, PINTEREST_APP_ID)
self.assertNotEqual(app_secret, PINTEREST_APP_SECRET)

try:
with self.assertRaises(SdkException):
PinterestSDKClient._get_access_token(
refresh_token=refresh_token,
app_id=app_id,
app_secret=app_secret
)
self.assertTrue(False)
except SdkException as e:
self.assertTrue(True)

0 comments on commit 056bcaf

Please sign in to comment.