Skip to content

Commit

Permalink
CHO: Remove commented out code and update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Apr 8, 2024
1 parent 2e1d7b2 commit 2f43371
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
14 changes: 2 additions & 12 deletions terraform/storage.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Add a static bucket (public contents)
# Add a bucket to store cloud function source code in.
resource "google_storage_bucket" "twined_gcp_source" {
name = "twined-gcp"
location = "EU"
Expand All @@ -13,21 +13,11 @@ resource "google_storage_bucket" "twined_gcp_source" {
}


# Make static bucket contents public
# Make bucket contents public.
resource "google_storage_bucket_iam_binding" "static_assets_object_viewer" {
bucket = google_storage_bucket.twined_gcp_source.name
role = "roles/storage.objectViewer"
members = [
"allUsers"
]
}


## Allow operating service account to generate signed upload urls
#resource "google_storage_bucket_iam_binding" "media_assets_object_admin" {
# bucket = google_storage_bucket.media_assets.name
# role = "roles/storage.objectAdmin"
# members = [
# "serviceAccount:${google_service_account.server_service_account.email}"
# ]
#}
4 changes: 2 additions & 2 deletions tests/mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class MockCloudEvent:
data: dict


# This class is duplicated from `data-gateway` (see ATTRIBUTIONS.md).
# This class is duplicated from `aerosense-ai/data-gateway` (see ATTRIBUTIONS.md).
class MockBigQueryClient:
def __init__(self, expected_query_results=None):
self.expected_query_results = expected_query_results or [[]]
Expand Down Expand Up @@ -51,7 +51,7 @@ def query(self, query, *args, **kwargs):
return result


# This class is duplicated from `data-gateway` (see ATTRIBUTIONS.md).
# This class is duplicated from `aerosense-ai/data-gateway` (see ATTRIBUTIONS.md).
class MockQueryResult:
def __init__(self, result):
self._result = result
Expand Down
7 changes: 1 addition & 6 deletions tests/test_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
REPOSITORY_ROOT = os.path.dirname(os.path.dirname(__file__))


# # Manually add the cloud_functions package to the path (its imports have to be done in a certain way for Google Cloud
# # Functions to accept them that doesn't work when running/testing the package locally).
# sys.path.insert(0, os.path.abspath(os.path.join(REPOSITORY_ROOT, "functions", "event_handler")))
# from functions.event_handler.main import store_pub_sub_event_in_bigquery


class TestEventHandler(unittest.TestCase):
def test_store_pub_sub_event_in_bigquery(self):
"""Test that the `event_handler` cloud function can receive, parse, and store an event in BigQuery."""
cloud_event = MockCloudEvent(
data={
"message": {
Expand Down

0 comments on commit 2f43371

Please sign in to comment.