def assert_test_case_action_results( self, action_name, action_case, test_case, test_fixture, action_response, job_response, msg=None, **kwargs ): if 'expects' in action_case: assert_subset_structure( action_case.get('expects', {}), action_response.body, False, msg, ) if 'not_expects' in action_case: assert_not_expected( action_case['not_expects'], action_response.body, msg, )
def test_assert_subset_structure_extras(self): assertions.assert_subset_structure( {'foo': 'bar'}, { 'foo': 'bar', 'baz': 'qux' }, subset_lists=True, )
def test_assert_subset_structure_one_item_subset_of_actual_list(self): assertions.assert_subset_structure( {'foo': { 'bar': 'baz' }}, {'foo': { 'bar': ['baz', 'qux'] }}, subset_lists=True, )
def test_assert_subset_structure_missing(self): with self.assertRaises(AssertionError) as error_info: assertions.assert_subset_structure( {'foo': None}, {'baz': 'qux'}, subset_lists=True, ) self.assertNotIn('DATA ERROR', error_info.exception.args[0]) self.assertIn('Missing values', error_info.exception.args[0])
def test_assert_subset_structure_list_not_exact(self): with self.assertRaises(AssertionError) as error_info: assertions.assert_subset_structure( {'foo': { 'bar': ['baz', 'qux', 'flem'] }}, {'foo': { 'bar': ['baz', 'qux'] }}, ) self.assertNotIn('DATA ERROR', error_info.exception.args[0]) self.assertIn('Missing values', error_info.exception.args[0])
def test_assert_subset_structure_mismatch(self): with self.assertRaises(AssertionError) as error_info: assertions.assert_subset_structure( {'foo': None}, {'foo': 'bar'}, subset_lists=True, msg='Include this in the message', ) self.assertTrue(error_info.exception.args[0].startswith( 'Include this in the message')) self.assertIn('DATA ERROR', error_info.exception.args[0]) self.assertIn('Mismatch values', error_info.exception.args[0])
def test_assert_subset_structure_one_item_not_subset_of_actual_list(self): with self.assertRaises(AssertionError) as error_info: assertions.assert_subset_structure( {'foo': { 'bar': 'flem' }}, {'foo': { 'bar': ['baz', 'qux'] }}, subset_lists=True, ) self.assertNotIn('DATA ERROR', error_info.exception.args[0]) self.assertIn('Missing values', error_info.exception.args[0])
def test_assert_subset_structure_empty_list_not_empty(self): with self.assertRaises(AssertionError) as error_info: assertions.assert_subset_structure( {'foo': { 'bar': [] }}, {'foo': { 'bar': ['baz', 'qux'] }}, subset_lists=True, ) self.assertNotIn('DATA ERROR', error_info.exception.args[0]) self.assertIn('Mismatch values', error_info.exception.args[0])
def test_assert_subset_structure_none(self): assertions.assert_subset_structure( {'foo': None}, {'foo': None}, subset_lists=True, )