Example #1
0
def index():
    if request.method == 'GET':
        imgs = Image.get_images(session)

        pages = math.ceil(Image.get_image_count(session) / 50)

        return render_template('main/index.jade',
                               title='Home',
                               images=imgs,
                               page=1,
                               pages=pages,
                               orderby='desc')
Example #2
0
 def test_get_image_count(self):
     result = Image.get_image_count(self.session)
     self.assertIsNotNone(result)
     self.assertGreater(result, 0)
Example #3
0
    def test_create_image(self):
        file = r'./scarlett/static/img/PSD.png'
        result = Image.create_image(self.session, self.storage, file)

        self.assertIsNotNone(result)
Example #4
0
 def test_get_images(self):
     limit = 50
     result = Image.get_images(self.session, limit)
     self.assertIsNotNone(result)
     self.assertLessEqual(len(result), limit)
Example #5
0
 def test_dhash(self):
     test_image = r'./scarlett/static/img/PSD.png'
     expected_hash = 'f8e68eb2b2f8e0b4'
     dhash = Image.dhash(test_image)
     self.assertIsNotNone(dhash)
     self.assertEqual(expected_hash, dhash)