Skip to content

Commit

Permalink
chore: cleanup unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharest authored Aug 8, 2024
1 parent 0047106 commit 37f8062
Showing 1 changed file with 0 additions and 82 deletions.
82 changes: 0 additions & 82 deletions app/tests/intergrations/test_google_drive_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@ def test_get_google_service_raises_exception_if_pickle_string_is_invalid(pickle_
assert "Invalid pickle string" in str(e.value)


@patch("integrations.google_drive.get_google_service")
def test_add_metadata_returns_result(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.update.return_value.execute.return_value = {
"name": "test_folder",
"appProperties": {"key": "value"},
}
result = google_drive.add_metadata("file_id", "key", "value")
assert result == {"name": "test_folder", "appProperties": {"key": "value"}}


@patch("integrations.google_drive.get_google_service")
def test_create_folder_returns_folder_name(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.create.return_value.execute.return_value = {
"name": "test_folder"
}
assert google_drive.create_folder("test_folder") == "Created folder test_folder"


@patch("integrations.google_drive.get_google_service")
def test_create_new_folder_returns_folder_id(get_google_service_mock):
# test that a new folder created returns the folder id
Expand Down Expand Up @@ -125,38 +107,6 @@ def test_copy_file_to_folder(get_google_service_mock):
)


@patch("integrations.google_drive.get_google_service")
def test_delete_metadata_returns_result(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.update.return_value.execute.return_value = {
"name": "test_folder",
"appProperties": {},
}
result = google_drive.delete_metadata("file_id", "key")
get_google_service_mock.return_value.files.return_value.update.assert_called_once_with(
fileId="file_id",
body={"appProperties": {"key": None}},
fields="name, appProperties",
supportsAllDrives=True,
)
assert result == {"name": "test_folder", "appProperties": {}}


@patch("integrations.google_drive.get_google_service")
def test_get_document_by_channel_name(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.list.return_value.execute.return_value = {
"files": [
{
"name": "test_document",
"id": "test_document_id",
"appProperties": {},
}
]
}
assert google_drive.get_document_by_channel_name("test_channel_name") == [
{"name": "test_document", "id": "test_document_id", "appProperties": {}}
]


@patch("integrations.google_drive.get_google_service")
def test_list_folders_returns_folder_names(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.list.return_value.execute.return_value = {
Expand Down Expand Up @@ -202,38 +152,6 @@ def test_update_incident_list(get_google_service_mock):
)


@patch("integrations.google_drive.get_google_service")
def test_close_incident_document(get_google_service_mock):
# Define a mock response for the batchUpdate call
get_google_service_mock.return_value.documents.return_value.batchUpdate.return_value.execute.return_value = {
"status": "success"
}

# Assert that the function returns the correct response
assert google_drive.close_incident_document("file_id") == {"status": "success"}


@patch("integrations.google_drive.get_google_service")
def test_update_spreadsheet(get_google_service_mock):
# Define a mock response for the get values call
mock_values = [
["Channel A", "Detail 1", "Open"],
["Channel B", "Detail 2", "In Progress"],
["Channel C", "Detail 3", "Reviewed"],
]

# get the return values from the mock
get_google_service_mock.return_value.spreadsheets.return_value.values.return_value.get.return_value.execute.return_value = {
"values": mock_values
}

# Define a channel name to search for
channel_name = "Channel B"

# assert that the function returns the correct response
assert google_drive.update_spreadsheet_close_incident(channel_name) is True


def create_mock_document(content):
elements = [
{
Expand Down

0 comments on commit 37f8062

Please sign in to comment.