Skip to content

Commit

Permalink
Test the obs test output
Browse files Browse the repository at this point in the history
  • Loading branch information
RickWangPerth committed Nov 28, 2024
1 parent 1f1ac20 commit a8f26be
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 39 deletions.
14 changes: 11 additions & 3 deletions observations/lookups.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,20 @@
)
NESTING_PRESENT = ("nest-with-eggs", "nest-unsure-of-eggs")

NEST_AGE_DEFAULT = "fresh"
# NEST_AGE_DEFAULT = "fresh"
# NEST_AGE_CHOICES = (
# (NEST_AGE_DEFAULT, "Fresh, made last night"),
# ("missed", "Missed turtle, made within past hours"),
# ("old", "Old, made before last night"),
# ("unknown", "Unknown age"),
# )

NEST_AGE_DEFAULT = "unknown"
NEST_AGE_CHOICES = (
(NEST_AGE_DEFAULT, "Fresh, made last night"),
("fresh", "Fresh, made last night"),
("missed", "Missed turtle, made within past hours"),
("old", "Old, made before last night"),
("unknown", "Unknown age"),
(NEST_AGE_DEFAULT, "Unknown age"),
)

NEST_TYPE_DEFAULT = "track-not-assessed"
Expand Down
36 changes: 18 additions & 18 deletions observations/tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,24 +258,24 @@ def test_flag_nests_with_specific_species_in_ningaloo(self, mock_get_logger):
call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation: Dermochelys coriacea (Leatherback turtle) at Ningaloo')

# @patch('logging.getLogger')
# def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
# mock_logger = MagicMock()
# mock_get_logger.return_value = mock_logger

# TurtleNestEncounter.objects.create(
# site=self.area,
# status=Encounter.STATUS_IMPORTED,
# species=TURTLE_SPECIES,
# nest_age=NEST_AGE,
# nest_type=NEST_TYPE,
# reporter=self.unknown_user,
# when=datetime.now(pytz.utc),
# where=Point(0.0, 0.0)
# )

# call_command('automated_qa_checks')
# mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')
@patch('logging.getLogger')
def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger

TurtleNestEncounter.objects.create(
site=self.area,
status=Encounter.STATUS_IMPORTED,
species=TURTLE_SPECIES,
nest_age=NEST_AGE,
nest_type=NEST_TYPE,
reporter=self.unknown_user,
when=datetime.now(pytz.utc),
where=Point(0.0, 0.0)
)

call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')

@patch('logging.getLogger')
def test_mark_imported_nests_as_curated(self, mock_get_logger):
Expand Down
36 changes: 18 additions & 18 deletions observations/tests/test_management_commands_auto_qa_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,24 +258,24 @@ def test_flag_nests_with_specific_species_in_ningaloo(self, mock_get_logger):
call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation: Dermochelys coriacea (Leatherback turtle) at Ningaloo')

# @patch('logging.getLogger')
# def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
# mock_logger = MagicMock()
# mock_get_logger.return_value = mock_logger

# TurtleNestEncounter.objects.create(
# site=self.area,
# status=Encounter.STATUS_IMPORTED,
# species=TURTLE_SPECIES,
# nest_age=NEST_AGE,
# nest_type=NEST_TYPE,
# reporter=self.unknown_user,
# when=datetime.now(pytz.utc),
# where=Point(0.0, 0.0)
# )

# call_command('automated_qa_checks')
# mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')
@patch('logging.getLogger')
def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger

TurtleNestEncounter.objects.create(
site=self.area,
status=Encounter.STATUS_IMPORTED,
species=TURTLE_SPECIES,
nest_age=NEST_AGE,
nest_type=NEST_TYPE,
reporter=self.unknown_user,
when=datetime.now(pytz.utc),
where=Point(0.0, 0.0)
)

call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')

@patch('logging.getLogger')
def test_mark_imported_nests_as_curated(self, mock_get_logger):
Expand Down

0 comments on commit a8f26be

Please sign in to comment.