Ejemplo n.º 1
0
 def test_should_save_default_bbcode_tags_rewrites(self):
     # Setup
     tag = BBCodeTag(tag_definition='[b]{TEXT1}[/b]', html_replacement='<b>{TEXT1}</b>')
     # Run & check
     try:
         tag.clean()
     except ValidationError:
         self.fail('The following BBCode failed to validate: {}'.format(tag))
Ejemplo n.º 2
0
 def test_should_save_valid_tags(self):
     # Run & check
     for tag_dict in self.VALID_TAG_TESTS:
         tag = BBCodeTag(**tag_dict)
         try:
             tag.clean()
         except ValidationError:
             self.fail('The following BBCode failed to validate: {}'.format(tag_dict))
 def test_should_save_valid_tags(self):
     # Run & check
     for tag_dict in self.VALID_TAG_TESTS:
         tag = BBCodeTag(**tag_dict)
         try:
             tag.clean()
         except ValidationError:
             self.fail('The following BBCode failed to validate: {}'.format(
                 tag_dict))
 def test_should_save_default_bbcode_tags_rewrites(self):
     # Setup
     tag = BBCodeTag(tag_definition='[b]{TEXT1}[/b]',
                     html_replacement='<b>{TEXT1}</b>')
     # Run & check
     try:
         tag.clean()
     except ValidationError:
         self.fail(
             'The following BBCode failed to validate: {}'.format(tag))
Ejemplo n.º 5
0
 def test_should_allow_tag_updates_if_the_name_does_not_change(self):
     # Setup
     tag_dict = {'tag_definition': '[pr]{TEXT}[/pr]', 'html_replacement': '<pre>{TEXT}</pre>'}
     tag = BBCodeTag(**tag_dict)
     tag.save()
     # Run
     tag.html_replacement = '<span>{TEXT}</span>'
     # Check
     try:
         tag.clean()
     except ValidationError:
         self.fail('The following BBCode failed to validate: {}'.format(tag_dict))
 def test_should_allow_tag_updates_if_the_name_does_not_change(self):
     # Setup
     tag_dict = {
         'tag_definition': '[pr]{TEXT}[/pr]',
         'html_replacement': '<pre>{TEXT}</pre>'
     }
     tag = BBCodeTag(**tag_dict)
     tag.save()
     # Run
     tag.html_replacement = '<span>{TEXT}</span>'
     # Check
     try:
         tag.clean()
     except ValidationError:
         self.fail(
             'The following BBCode failed to validate: {}'.format(tag_dict))
 def test_should_not_save_invalid_tags(self):
     # Run & check
     for tag_dict in self.ERRONEOUS_TAGS_TESTS:
         with pytest.raises(ValidationError):
             tag = BBCodeTag(**tag_dict)
             tag.clean()
Ejemplo n.º 8
0
 def test_should_not_save_invalid_tags(self):
     # Run & check
     for tag_dict in self.ERRONEOUS_TAGS_TESTS:
         with pytest.raises(ValidationError):
             tag = BBCodeTag(**tag_dict)
             tag.clean()