Exemple #1
0
 def test_a_locked_picture_returns_next(self, mocklock):
     mocklock.side_effect = [
         True, False
     ]  # this is a special call to only lock the 1st file
     filelist = ["pic1.jpeg", "pic1.jpeg.lock", "pic2.jpeg"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "pic2.jpeg"
Exemple #2
0
 def test_getting_the_latest_picture(self, mocklock):
     mocklock.return_value = False
     filelist = [
         '20150905_1225_29_cam0.jpg', '20150905_1225_33_cam0.jpg',
         '20150905_1225_26_cam0.jpg'
     ]
     file = camup.get_picture_from_storage(filelist, reverse=True)
     self.assertEqual(file, '20150905_1225_33_cam0.jpg')
Exemple #3
0
 def test_a_normal_list(self, mocklock):
     mocklock.return_value = False
     filelist = [
         '20150905_1225_29_cam0.jpg', '20150905_1225_33_cam0.jpg',
         '20150905_1225_26_cam0.jpg'
     ]
     file = camup.get_picture_from_storage(filelist)
     self.assertEqual(file, '20150905_1225_26_cam0.jpg')
Exemple #4
0
 def test_non_images_are_ignored(self):
     filelist = ["foo.txt", "bar.jpog", "thumbs.db"]
     file = camup.get_picture_from_storage(filelist)
     assert file is None
Exemple #5
0
 def test_caps_are_the_same(self, mocklock):
     mocklock.return_value = False
     filelist = ["foo.JpG"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "foo.JpG"
Exemple #6
0
 def test_one_jpg_one_pic(self, mocklock):
     mocklock.return_value = False
     filelist = ["foo.jpg"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "foo.jpg"
Exemple #7
0
    def test_no_list_no_result(self):
        filelist = []
        file = camup.get_picture_from_storage(filelist)

        assert file is None
Exemple #8
0
 def test_none_is_none(self):
     with self.assertRaises(ValueError):
         camup.get_picture_from_storage(None)
 def test_non_images_are_ignored(self):
     filelist = ["foo.txt","bar.jpog","thumbs.db"]
     file = camup.get_picture_from_storage(filelist)
     assert file is None
 def test_a_locked_picture_returns_next(self,mocklock):
     mocklock.side_effect = [True, False] # this is a special call to only lock the 1st file
     filelist = ["pic1.jpeg","pic1.jpeg.lock","pic2.jpeg"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "pic2.jpeg"
 def test_caps_are_the_same(self,mocklock):
     mocklock.return_value = False
     filelist = ["foo.JpG"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "foo.JpG"
 def test_one_jpg_one_pic(self,mocklock):
     mocklock.return_value = False
     filelist = ["foo.jpg"]
     file = camup.get_picture_from_storage(filelist)
     assert file == "foo.jpg"