diff --git a/mailchimp_api/workflow.py b/mailchimp_api/workflow.py index d4bf48a..1264bfa 100644 --- a/mailchimp_api/workflow.py +++ b/mailchimp_api/workflow.py @@ -27,7 +27,7 @@ def _get_config() -> Config: config = _get_config() -@wf.register(name="simple_learning", description="Student and teacher learning chat") # type: ignore[misc] +@wf.register(name="mailchimp_chat", description="Mailchimp tags update chat") # type: ignore[misc] def simple_workflow(ui: UI, params: dict[str, Any]) -> str: timestamp = time.strftime("%Y-%m-%d-%H-%M-%S") body = f"""Please upload **.csv** file with the email addresses for which you want to update the tags. diff --git a/tests/deployment/test_main_1_fastapi.py b/tests/deployment/test_main_1_fastapi.py index f2963f0..4bea806 100644 --- a/tests/deployment/test_main_1_fastapi.py +++ b/tests/deployment/test_main_1_fastapi.py @@ -74,3 +74,14 @@ def test_upload_endpoint_raises_400_error_if_file_is_not_csv(self) -> None: ) assert response.status_code == 400 assert "Only CSV files are supported" in response.text + + def test_upload_endpoint_raises_400_error_if_email_column_not_found(self) -> None: + csv_content = "name\n" + csv_file = BytesIO(csv_content.encode("utf-8")) + response = self.client.post( + "/upload", + files={"file": ("emails.csv", csv_file)}, + data={"timestamp": "test-22-09-2021"}, + ) + assert response.status_code == 400 + assert "'email' column not found in CSV file" in response.text