diff --git a/observations/lookups.py b/observations/lookups.py index d7a8278f..62cfd6e8 100644 --- a/observations/lookups.py +++ b/observations/lookups.py @@ -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" diff --git a/observations/tests/test_management_commands.py b/observations/tests/test_management_commands.py index 93197aa1..57504f42 100644 --- a/observations/tests/test_management_commands.py +++ b/observations/tests/test_management_commands.py @@ -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): diff --git a/observations/tests/test_management_commands_auto_qa_checks.py b/observations/tests/test_management_commands_auto_qa_checks.py index 93197aa1..57504f42 100644 --- a/observations/tests/test_management_commands_auto_qa_checks.py +++ b/observations/tests/test_management_commands_auto_qa_checks.py @@ -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):