def METHOD_NAME(self, file):
    resolver = Mock(return_value='image/png')
    factory = Mock(return_value=resolver)
    validator = MimeTypeAllowedValidator(factory, ('image/png', 'image/jpeg'))
    validator(file)