def test_negative(self): with open(join(self.datadir, 'textfile.jpg')) as image: buf = image.buffer.read() self.assertFalse(AllowedMime.validate( buf=buf, mimes=self.mimes, ))
def test_positive(self): with open(join(self.datadir, 'validimage.jpg')) as image: buf = image.buffer.read() self.assertTrue(AllowedMime.validate( buf=buf, mimes=self.mimes, ))