예제 #1
0
    def test_dash_d(self):
        try:
            # load album y
            tu = TestUtils()
            assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
            # load album x and y
            tu.load_photoset("album1")
            # launch lycheesync
            src = tu.conf['testphotopath']
            lych = tu.conf['lycheepath']
            conf = tu.conf['conf']

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.check_album_size(
                "album1") == 1, "album 1 not correctly loaded"

            # clean input pics content
            tu.delete_dir_content(src)
            # load album x
            tu.load_photoset("album3")

            # run
            cmd = 'python main.py {} {} {} -v -d'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.check_album_size(
                "album3") == 4, "album 3 not correctly loaded"
            # album 1 has been deleted
            a1_check = tu.album_exists_in_db("album1")
            assert not (a1_check), "album 1  still exists"

            expected_albums = 1
            expected_photos = 4
            self.check_grand_total(expected_albums, expected_photos)

        except AssertionError:
            raise
        except Exception as e:
            logger.exception(e)
            assert False
예제 #2
0
    def test_dash_d(self):
        try:
            # load album y
            tu = TestUtils()
            assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
            # load album x and y
            tu.load_photoset("album1")
            # launch lycheesync
            src = tu.conf['testphotopath']
            lych = tu.conf['lycheepath']
            conf = tu.conf['conf']

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.check_album_size("album1") == 1, "album 1 not correctly loaded"

            # clean input pics content
            tu.delete_dir_content(src)
            # load album x
            tu.load_photoset("album3")

            # run
            cmd = 'python main.py {} {} {} -v -d'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.check_album_size("album3") == 4, "album 3 not correctly loaded"
            # album 1 has been deleted
            a1_check = tu.album_exists_in_db("album1")
            assert not(a1_check), "album 1  still exists"

            expected_albums = 1
            expected_photos = 4
            self.check_grand_total(expected_albums, expected_photos)

        except AssertionError:
            raise
        except Exception as e:
            logger.exception(e)
            assert False
예제 #3
0
    def test_dash_r(self):
        try:
            tu = TestUtils()
            assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
            # load album x and y
            tu.load_photoset("album1")
            tu.load_photoset("album3")

            # launch lycheesync
            src = tu.conf['testphotopath']
            lych = tu.conf['lycheepath']
            conf = tu.conf['conf']

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.album_exists_in_db("album1")
            # read album date for album1
            album1_date = tu.get_album_creation_date('album1')
            # read album date for album3
            album3_date = tu.get_album_creation_date('album3')

            # empty tmp pictures folder
            tu.delete_dir_content(src)

            tu.dump_table('lychee_albums')
            # sleep 1 s to make time album signature different
            time.sleep(2)

            # load album3
            tu.load_photoset("album3")

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            album1_date_2 = tu.get_album_creation_date('album1')
            album3_date_2 = tu.get_album_creation_date('album3')
            tu.dump_table('lychee_albums')
            # y date < time
            assert album1_date == album1_date_2, 'album 1 is untouched'
            assert tu.check_album_size('album1') == 1

            # x date > time
            assert album3_date < album3_date_2, 'album 3 has been modified'
            assert tu.check_album_size('album3') == 4

            expected_albums = 2
            expected_photos = 5
            self.check_grand_total(expected_albums, expected_photos)

        except AssertionError:
            raise
        except Exception as e:
            logger.exception(e)
            assert False
예제 #4
0
    def test_dash_r(self):
        try:
            tu = TestUtils()
            assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
            # load album x and y
            tu.load_photoset("album1")
            tu.load_photoset("album3")

            # launch lycheesync
            src = tu.conf['testphotopath']
            lych = tu.conf['lycheepath']
            conf = tu.conf['conf']

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            assert tu.album_exists_in_db("album1")
            # read album date for album1
            album1_date = tu.get_album_creation_date('album1')
            # read album date for album3
            album3_date = tu.get_album_creation_date('album3')

            # empty tmp pictures folder
            tu.delete_dir_content(src)

            tu.dump_table('lychee_albums')
            # sleep 1 s to make time album signature different
            time.sleep(2)

            # load album3
            tu.load_photoset("album3")

            # run
            cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
            logger.info(cmd)
            retval = -1
            retval = subprocess.call(cmd, shell=True)
            # no crash
            assert (retval == 0), "process result is ok"

            album1_date_2 = tu.get_album_creation_date('album1')
            album3_date_2 = tu.get_album_creation_date('album3')
            tu.dump_table('lychee_albums')
            # y date < time
            assert album1_date == album1_date_2, 'album 1 is untouched'
            assert tu.check_album_size('album1') == 1

            # x date > time
            assert album3_date < album3_date_2, 'album 3 has been modified'
            assert tu.check_album_size('album3') == 4

            expected_albums = 2
            expected_photos = 5
            self.check_grand_total(expected_albums, expected_photos)

        except AssertionError:
            raise
        except Exception as e:
            logger.exception(e)
            assert False