Esempio n. 1
0
 def test_should_not_save_erroneous_smilies(self):
     # Run & check
     for smiley_code in self.ERRONEOUS_SMILIES_FIELS_TESTS:
         smiley = SmileyTag()
         smiley.code = smiley_code
         self.image.open()  # Re-open the ImageField
         smiley.image.save('icon_e_wink.gif', self.image)
         with pytest.raises(ValidationError):
             smiley.full_clean()
 def test_should_not_save_erroneous_smilies(self):
     # Run & check
     for smiley_code in self.ERRONEOUS_SMILIES_FIELS_TESTS:
         smiley = SmileyTag()
         smiley.code = smiley_code
         self.image.open()  # Re-open the ImageField
         smiley.image.save('icon_e_wink.gif', self.image)
         with pytest.raises(ValidationError):
             smiley.full_clean()
Esempio n. 3
0
 def test_can_save_valid_smilies(self):
     # Run & check
     for smiley_code in self.SMILIES_FIELDS_TESTS:
         smiley = SmileyTag()
         smiley.code = smiley_code
         self.image.open()  # Re-open the ImageField
         smiley.image.save('icon_e_wink.gif', self.image)
         try:
             smiley.full_clean()
         except ValidationError:
             pytest.xfail('The following smiley code failed to validate: {}'.format(smiley_code))
 def test_can_save_valid_smilies(self):
     # Run & check
     for smiley_code in self.SMILIES_FIELDS_TESTS:
         smiley = SmileyTag()
         smiley.code = smiley_code
         self.image.open()  # Re-open the ImageField
         smiley.image.save('icon_e_wink.gif', self.image)
         try:
             smiley.full_clean()
         except ValidationError:
             pytest.xfail('The following smiley code failed to validate: {}'.format(smiley_code))
 def setUp(self):
     self.parser = get_parser()
     # Set up an image used for doing smilies tests
     f = open(settings.MEDIA_ROOT + "/icon_e_wink.gif", "rb")
     image_file = File(f)
     self.image = image_file
     # Set up a smiley tag
     smiley = SmileyTag()
     smiley.code = ':test:'
     smiley.image.save('icon_e_wink.gif', self.image)
     smiley.save()
     _init_bbcode_smilies(self.parser)
 def create_smilies(self):
     self.parser = get_parser()
     self.parser_loader = BBCodeParserLoader(parser=self.parser)
     # Set up an image used for doing smilies tests
     f = open(settings.MEDIA_ROOT + '/icon_e_wink.gif', 'rb')
     image_file = File(f)
     self.image = image_file
     # Set up a smiley tag
     smiley = SmileyTag()
     smiley.code = ':test:'
     smiley.image.save('icon_e_wink.gif', self.image)
     smiley.save()
     self.parser_loader.init_bbcode_smilies()
 def create_smilies(self):
     self.parser = get_parser()
     self.parser_loader = BBCodeParserLoader(parser=self.parser)
     # Set up an image used for doing smilies tests
     f = open(settings.MEDIA_ROOT + '/icon_e_wink.gif', 'rb')
     image_file = File(f)
     self.image = image_file
     # Set up a smiley tag
     smiley = SmileyTag()
     smiley.code = ':test:'
     smiley.image.save('icon_e_wink.gif', self.image)
     smiley.save()
     self.parser_loader.init_bbcode_smilies()