Exemplo n.º 1
0
 def test_invalid_file(self):
     """
     When file is not a zip file, ValidationError should be raised.
     """
     f = File('invalidfile')
     f.content_type = 'invalid'
     with self.assertRaises(ValidationError):
         validatefiletype(f)
Exemplo n.º 2
0
 def test_txt_file(self):
     """
     When file is a TXT file, no exception should be raised.
     """
     f = File('txtfile')
     f.content_type = 'text/plain'
     try:
         validatefiletype(f)
     except ValidationError:
         self.fail('Should not raise Validation Error on a TXT file.')