示例#1
0
    def test_long_album(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # get max_width column album name width
        maxwidth = tu.get_column_width("lychee_albums", "title")
        logger.info("album title length: " + str(maxwidth))
        # create long album name
        dest_alb_name = 'a' * (maxwidth + 10)
        assert len(dest_alb_name) == (maxwidth + 10)

        # copy album with name
        tu.load_photoset("album1", dest_alb_name)

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

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # there is a max_width album
        albums = tu.get_album_ids_titles()
        alb_real_name = albums.pop()["title"]
        assert len(
            alb_real_name) == maxwidth, "album len is not " + str(maxwidth)
示例#2
0
    def test_long_album(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # get max_width column album name width
        maxwidth = tu.get_column_width("lychee_albums", "title")
        logger.info("album title length: " + str(maxwidth))
        # create long album name
        dest_alb_name = 'a' * (maxwidth + 10)
        assert len(dest_alb_name) == (maxwidth + 10)

        # copy album with name
        tu.load_photoset("album1", dest_alb_name)

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

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # there is a max_width album
        albums = tu.get_album_ids_titles()
        alb_real_name = albums.pop()["title"]
        assert len(alb_real_name) == maxwidth, "album len is not " + str(maxwidth)
示例#3
0
    def test_dash_wo_s(self):
        # -s => no album reorder
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load a bunch of album
        tu.load_photoset("aaa")
        tu.load_photoset("mini")
        tu.load_photoset("zzzz")
        tu.load_photoset("album1")
        tu.load_photoset("album3")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # get a_id, a_names
        list = tu.get_album_ids_titles()
        logger.info(list)
        # album name sorted

        # id sorted
        ids = sorted([x['id'] for x in list])
        titles = sorted([x['title'] for x in list])

        logger.info(ids)
        logger.info(titles)

        # combine
        ordered_list = zip(ids, titles)
        logger.info(ordered_list)
        # for each sorted
        well_sorted = True
        for x in ordered_list:
            logger.info(x)

            if (tu.get_album_id(x[1]) != x[0]):
                well_sorted = False

        assert (not well_sorted), "elements should not be sorted"
示例#4
0
    def test_dash_wo_s(self):
        # -s => no album reorder
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load a bunch of album
        tu.load_photoset("aaa")
        tu.load_photoset("mini")
        tu.load_photoset("zzzz")
        tu.load_photoset("album1")
        tu.load_photoset("album3")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # get a_id, a_names
        list = tu.get_album_ids_titles()
        logger.info(list)
        # album name sorted

        # id sorted
        ids = sorted([x['id'] for x in list])
        titles = sorted([x['title'] for x in list])

        logger.info(ids)
        logger.info(titles)

        # combine
        ordered_list = zip(ids, titles)
        logger.info(ordered_list)
        # for each sorted
        well_sorted = True
        for x in ordered_list:
            logger.info(x)

            if (tu.get_album_id(x[1]) != x[0]):
                well_sorted = False

        assert (not well_sorted), "elements should not be sorted"