Skip to content

Commit

Permalink
move tests to new module
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Feb 12, 2025
1 parent 94285be commit 343968d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
22 changes: 22 additions & 0 deletions src/meshapi/tests/test_join_record_processor_bad_env_vars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from unittest.mock import patch
from botocore.exceptions import ClientError
from django.test import TestCase

from meshapi.util.join_records import JoinRecordProcessor

class TestJoinRecordProcessorBadEnvVars(TestCase):
@patch("meshapi.util.join_records.JOIN_RECORD_BUCKET_NAME", "")
def test_missing_bucket_name(self):
with self.assertRaises(EnvironmentError):
JoinRecordProcessor()

@patch("meshapi.util.join_records.JOIN_RECORD_PREFIX", "")
def test_missing_prefix(self):
with self.assertRaises(EnvironmentError):
JoinRecordProcessor()

@patch("meshapi.util.join_records.JOIN_RECORD_BUCKET_NAME", "chom")
def test_bad_bucket_name(self):
with self.assertRaises(ClientError):
JoinRecordProcessor().get_all()
15 changes: 0 additions & 15 deletions src/meshapi/tests/test_replay_join_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ def setUp(self) -> None:
def tearDown(self) -> None:
self.p.flush_test_data()

@patch("meshapi.util.join_records.JOIN_RECORD_BUCKET_NAME", "")
def test_missing_bucket_name(self):
with self.assertRaises(EnvironmentError):
JoinRecordProcessor()

@patch("meshapi.util.join_records.JOIN_RECORD_PREFIX", "")
def test_missing_prefix(self):
with self.assertRaises(EnvironmentError):
JoinRecordProcessor()

@patch("meshapi.util.join_records.JOIN_RECORD_BUCKET_NAME", "chom")
def test_bad_bucket_name(self):
with self.assertRaises(ClientError):
self.p.get_all()

# I broke the help menu once upon a time so I need to make sure this works.
def test_help_works(self):
with self.assertRaises(SystemExit):
Expand Down

0 comments on commit 343968d

Please sign in to comment.