Skip to content

Commit

Permalink
removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
wrp801 committed Aug 15, 2024
1 parent 1be73d1 commit ce85e9d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def _set_env_vars(self):
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = self.service_account

def connect(self):
# tmp_path = self._set_env_vars()
# credentials = service_account.Credentials.from_service_account_file(
# tmp_path, scopes=self.SCOPES
# )
credentials = drive_utils.get_credentials()
service = build("drive", "v3", credentials=credentials)
return service
Expand Down
66 changes: 33 additions & 33 deletions shipyard_blueprints/googledrive/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# import os
# import pytest
# from shipyard_googledrive import GoogleDriveClient
# from dotenv import load_dotenv, find_dotenv
#
# load_dotenv(find_dotenv())
#
# if env_exists := os.path.exists(".env"):
# load_dotenv()
#
#
# @pytest.mark.skipif(not env_exists, reason="No .env file found")
# def conn_helper(client: GoogleDriveClient) -> int:
# try:
# client.connect()
# return 0
# except Exception as e:
# print("Could not connect to google drive")
# return 1
#
#
# @pytest.mark.skipif(not env_exists, reason="No .env file found")
# def test_good_connection():
# creds = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
# client = GoogleDriveClient(creds)
# assert conn_helper(client) == 0
#
#
# @pytest.mark.skipif(not env_exists, reason="No .env file found")
# def test_bad_connection():
# creds = "bad_creds"
# client = GoogleDriveClient(creds)
# assert conn_helper(client) == 1
import os
import pytest
from shipyard_googledrive import GoogleDriveClient
from dotenv import load_dotenv, find_dotenv

load_dotenv(find_dotenv())

if env_exists := os.path.exists(".env"):
load_dotenv()


@pytest.mark.skipif(not env_exists, reason="No .env file found")
def conn_helper(client: GoogleDriveClient) -> int:
try:
client.connect()
return 0
except Exception as e:
print("Could not connect to google drive")
return 1


@pytest.mark.skipif(not env_exists, reason="No .env file found")
def test_good_connection():
creds = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
client = GoogleDriveClient(creds)
assert conn_helper(client) == 0


@pytest.mark.skipif(not env_exists, reason="No .env file found")
def test_bad_connection():
creds = "bad_creds"
client = GoogleDriveClient(creds)
assert conn_helper(client) == 1

0 comments on commit ce85e9d

Please sign in to comment.