aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2025-02-19 03:48:14 +0000
committerAlex Schofield <git@ajschof.me>2025-02-19 03:48:14 +0000
commit648c3785071adfae163e7ac1321f19188a5e4921 (patch)
treed716cfca3d723f8137a4982c764317744ad24131 /test
parent6b0fc64f71b65625ee59dffc8b8bd0459cde64fb (diff)
downloadgdpr-obfuscator-648c3785071adfae163e7ac1321f19188a5e4921.tar.gz
gdpr-obfuscator-648c3785071adfae163e7ac1321f19188a5e4921.zip
use already initialised reader object instead of creating new CSVReader instance
Diffstat (limited to 'test')
-rw-r--r--test/test_csv_reader.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_csv_reader.py b/test/test_csv_reader.py
index 0206542..d6129e7 100644
--- a/test/test_csv_reader.py
+++ b/test/test_csv_reader.py
@@ -3,7 +3,7 @@ from moto import mock_aws
from obfuscator.csv_reader import CSVReader
import pytest
-reader = CSVReader()
+reader = CSVReader(log_level="DEBUG")
def test_empty_csv_should_return_no_content():
@@ -96,7 +96,7 @@ def test_read_s3_empty_csv_returns_empty_list():
setup_s3(s3, bucket, key, csv_content)
path = f"s3://{bucket}/{key}"
- data = CSVReader.read_s3(path)
+ data = reader.read_s3(path)
assert data == []
@@ -106,7 +106,7 @@ def test_read_s3_nonexistent_bucket_raises_exception():
key = "data/mock.csv"
path = f"s3://{bucket}/{key}"
with pytest.raises(Exception):
- CSVReader.read_s3(path)
+ reader.read_s3(path)
def test_read_s3_nonexistent_key_raises_exception():
@@ -120,7 +120,7 @@ def test_read_s3_nonexistent_key_raises_exception():
key = "data/nonexistent.csv"
path = f"s3://{bucket}/{key}"
with pytest.raises(Exception):
- CSVReader.read_s3(path)
+ reader.read_s3(path)
def test_read_s3_malformed_csv_returns_expected():
@@ -132,7 +132,7 @@ def test_read_s3_malformed_csv_returns_expected():
setup_s3(s3, bucket, key, csv_content)
path = f"s3://{bucket}/{key}"
- data = CSVReader.read_s3(path)
+ data = reader.read_s3(path)
expected = [{"1234": "5678", "Student 1": "Student 2", "Course 1": "Course 2"}]
assert data == expected
@@ -152,7 +152,7 @@ def test_read_s3_csv_with_extra_empty_lines():
setup_s3(s3, bucket, key, csv_content)
path = f"s3://{bucket}/{key}"
- data = CSVReader.read_s3(path)
+ data = reader.read_s3(path)
expected = [
{"student_id": "1234", "name": "Student 1", "course": "Course 1"},
{"student_id": "5678", "name": "Student 2", "course": "Course 2"},
@@ -173,7 +173,7 @@ def test_read_s3_csv_with_whitespace_in_fields():
setup_s3(s3, bucket, key, csv_content)
path = f"s3://{bucket}/{key}"
- data = CSVReader.read_s3(path)
+ data = reader.read_s3(path)
expected = [
{"student_id": " 1234 ", " name ": " Student 1 ", " course ": " Course 1 "},
{"student_id": "5678", " name ": "Student 2", " course ": "Course 2"},
git.ajschof.me — hosted by ajschofield — powered by cgit