Exemple #1
0
def image_fixture(http_path, image_filename):
    this_dir = os.path.abspath(os.path.dirname(__file__))
    fixtures_dir = os.path.join(this_dir, 'test_fixtures')
    if not os.path.exists(fixtures_dir):
        os.mkdir(fixtures_dir)

    image_path = os.path.join(fixtures_dir, image_filename)
    if not os.path.exists(image_path):
        urlretrieve(http_path + image_filename, image_path)

    context = mock.Mock(request=mock.Mock(focal_points=[]))
    engine = PilEngine(context)
    context.modules.engine = engine
    with open(image_path) as f:
        engine.load(f.read(), None)
    return context
Exemple #2
0
 def setUp(self):
     self.context = mock.Mock(request=mock.Mock(focal_points=[]))
     self.engine = PilEngine(self.context)
     self.context.modules.engine = self.engine
Exemple #3
0
 def setUp(self):
     super(DetectorTestCase, self).setUp()
     self.context.request = mock.Mock(focal_points=[])
     self.engine = PilEngine(self.context)
     self.context.modules.engine = self.engine
Exemple #4
0
 def setUp(self):
     self.context = mock.Mock(request=mock.Mock(focal_points=[]))
     self.context.config.MAX_PIXELS = 2**20
     self.engine = PilEngine(self.context)
     self.context.modules.engine = self.engine