mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
final
This commit is contained in:
@@ -5,7 +5,13 @@ from os import getenv
|
||||
import pytest
|
||||
from botocore.exceptions import ClientError
|
||||
|
||||
from app.aws.s3 import file_exists, get_s3_file, remove_csv_object, remove_s3_object
|
||||
from app.aws.s3 import (
|
||||
file_exists,
|
||||
get_phone_number_from_s3,
|
||||
get_s3_file,
|
||||
remove_csv_object,
|
||||
remove_s3_object,
|
||||
)
|
||||
|
||||
default_access_key = getenv("CSV_AWS_ACCESS_KEY_ID")
|
||||
default_secret_key = getenv("CSV_AWS_SECRET_ACCESS_KEY")
|
||||
@@ -39,6 +45,28 @@ def test_get_s3_file_makes_correct_call(notify_api, mocker):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"job, job_id, job_row_number, expected_phone_number",
|
||||
[
|
||||
("phone number\r\n+15555555555", "aaa", 0, "15555555555"),
|
||||
(
|
||||
"day of week,favorite color,phone number\r\nmonday,green,15551111111\r\ntuesday,red,15552222222",
|
||||
"bbb",
|
||||
1,
|
||||
"15552222222",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_phone_number_from_s3(
|
||||
mocker, job, job_id, job_row_number, expected_phone_number
|
||||
):
|
||||
get_job_mock = mocker.patch("app.aws.s3.get_job_from_s3")
|
||||
get_job_mock.return_value = job
|
||||
print(f"ABOUT TO CALL GET_PHONE_NUMBER_FROM_S3 WITH JOB_ID {job_id}")
|
||||
phone_number = get_phone_number_from_s3("service_id", job_id, job_row_number)
|
||||
assert phone_number == expected_phone_number
|
||||
|
||||
|
||||
def test_remove_csv_object(notify_api, mocker):
|
||||
get_s3_mock = mocker.patch("app.aws.s3.get_s3_object")
|
||||
remove_csv_object("mykey")
|
||||
|
||||
Reference in New Issue
Block a user