def test_incorrect_exp_domain_object_raises_exception(self) -> None: incorrect_change_dict = { 'state_name': 'State 3', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>old content html</p>', 'translation_html': '<p>In Hindi</p>', 'data_format': 'html' } with self.assertRaisesRegex( # type: ignore[no-untyped-call] Exception, 'Missing cmd key in change dict'): domain_objects_validator.validate_suggestion_change( incorrect_change_dict) incorrect_change_dict = { 'cmd': 'add_subtopic', 'state_name': 'State 3', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>old content html</p>', 'translation_html': '<p>In Hindi</p>', 'data_format': 'html' } with self.assertRaisesRegex( # type: ignore[no-untyped-call] Exception, '%s cmd is not allowed.' % incorrect_change_dict['cmd']): domain_objects_validator.validate_suggestion_change( incorrect_change_dict)
def test_correct_exp_domain_object_do_not_raises_exception(self) -> None: correct_change_dict = { 'cmd': 'add_written_translation', 'state_name': 'State 3', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>old content html</p>', 'translation_html': '<p>In Hindi</p>', 'data_format': 'html' } domain_objects_validator.validate_suggestion_change( correct_change_dict)