Skip to content

Commit

Permalink
Tests: add forgotten assert for test_deprecation_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Tattoo committed Oct 27, 2023
1 parent 2da31da commit abffa99
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/utest/oxygen_handler_result/test_deprecation_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ class TestDeprecationWarningWhenValidating(TestCase):
def setUp(self):
self.cli = OxygenCLI()

def _validate_warning_msg(self, warning, module_name):
warning_message = str(warning.warning)
for expected in (module_name,
'validation error for typed-dict',
'In Oxygen 1.0, handlers will need to produce valid results.'):
self.assertIn(expected, warning_message)

def test_warning_about_invalid_result(self):
handler = BaseHandler(get_config()['oxygen.junit'])

with self.assertWarns(UserWarning) as warning:
handler._validate({})

warning_message = str(warning.warning)
self.assertIn('oxygen.base_handler', warning_message)
self.assertIn('validation error for typed-dict', warning_message)
self.assertIn('In Oxygen 1.0, handlers will'
' need to produce valid results.', warning_message)
self._validate_warning_msg(warning, 'oxygen.base_handler')

@patch('oxygen.oxygen.RobotInterface')
def test_warning_about_invalid_result_in_CLI(self, mock_iface):
Expand All @@ -39,7 +42,9 @@ def test_warning_about_invalid_result_in_CLI(self, mock_iface):
'func': lambda **_: {**MINIMAL_SUITE_DICT, 'setup': []}
})

mock_iface.assert_any_call()
mock_iface.assert_any_call()
# this one has weird name because we fake `func` with lambda
self._validate_warning_msg(warning, 'test_deprecation_warning')

def test_deprecation_was_removed(self):
'''Remove this test once deprecation warning has been removed'''
Expand Down

0 comments on commit abffa99

Please sign in to comment.