Skip to content

Commit

Permalink
test: added integration test boilerplate for get_refresh_token_scope
Browse files Browse the repository at this point in the history
Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com>
  • Loading branch information
sudiptob2 authored and mshudrak committed Mar 7, 2023
1 parent b018588 commit 4fffc79
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/gcp_scanner/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,30 @@ def test_get_scope_from_rt_no_scope(self, mocked_post):
)


class TestScopesIntegration(unittest.TestCase):
"""Integration test against live test-porject."""
def setUp(self):
# TODO: get_creds_from_metadata or some other method should
# TODO: return refresh token
# TODO: this self.credentials does not have refresh_token
_, self.credentials = credsdb.get_creds_from_metadata()

def test_get_scope_from_rt(self):
"""Test get_scope_from_rt valid."""
ctx = {
"refresh_token": self.credentials.refresh_token,
"client_id": self.credentials.client_id,
"client_secret": self.credentials.client_secret,
}
actual = get_scopes_from_refresh_token(ctx)
self.assertTrue(
verify(
actual,
"refresh_scopes",
True,
)
)

class TestCrawler(unittest.TestCase):
"""Test crawler functionalities."""

Expand Down
2 changes: 2 additions & 0 deletions test/refresh_scopes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: update this file to put original scopes of the test projects
["scope1", "scope2", "scope3"]

0 comments on commit 4fffc79

Please sign in to comment.