当前位置: 首页>>代码示例>>Python>>正文


Python TestUtils.check_album_size方法代码示例

本文整理汇总了Python中tests.testutils.TestUtils.check_album_size方法的典型用法代码示例。如果您正苦于以下问题:Python TestUtils.check_album_size方法的具体用法?Python TestUtils.check_album_size怎么用?Python TestUtils.check_album_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.testutils.TestUtils的用法示例。


在下文中一共展示了TestUtils.check_album_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_dash_d

# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import check_album_size [as 别名]
    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
开发者ID:gandelman-a,项目名称:lycheesync,代码行数:51,代码来源:test_main.py

示例2: test_dash_r

# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import check_album_size [as 别名]
    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
开发者ID:gandelman-a,项目名称:lycheesync,代码行数:67,代码来源:test_main.py


注:本文中的tests.testutils.TestUtils.check_album_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。