示例#1
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_source(self):
    teller = ATM(s3_cache_dir, interval=10)

    r = teller.get_cache(url)
    source1 = r.source
    r = teller.get_cache(url)
    source2 = r.source

    teller.default()

    assert source1=="url" and source2=="cache"
示例#2
0
    def test_source(self):
        teller = ATM(s3_cache_dir, interval=10)

        r = teller.get_cache(url)
        source1 = r.source
        r = teller.get_cache(url)
        source2 = r.source

        teller.default()

        assert source1 == "url" and source2 == "cache"
示例#3
0
    def test_s3_liquidate(self):
        teller = ATM(s3_cache_dir)
        r = teller.get_cache(url)
        r = teller.get_cache(url2)

        assets = [f for f in teller.liquidate()]

        # remove files
        teller.default()

        assert len(assets) == 2
示例#4
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_s3_liquidate(self):
    teller = ATM(s3_cache_dir)
    r = teller.get_cache(url)
    r = teller.get_cache(url2)
    
    assets = [f for f in teller.liquidate()]

    # remove files
    teller.default()

    assert len(assets) == 2
示例#5
0
    def test_s3_statement(self):
        teller = ATM(s3_cache_dir)
        r = teller.get_cache(url)
        r = teller.get_cache(url2)

        # get statement
        statement = teller.statement()

        # remove files
        teller.default()

        assert len(statement) == 2
示例#6
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_s3_statement(self):
    teller = ATM(s3_cache_dir)
    r = teller.get_cache(url)
    r = teller.get_cache(url2)

    # get statement
    statement = teller.statement()

    # remove files
    teller.default()

    assert len(statement) == 2 
示例#7
0
    def test_local_default(self):
        teller = ATM(local_cache_dir)
        r = teller.get_cache(url)
        r = teller.get_cache(url2)

        statement1 = teller.statement()

        # now delete
        teller.default()

        # statement again
        statement2 = teller.statement()

        # remove cache directory
        shutil.rmtree(local_cache_dir)

        assert len(statement1) == 2 and len(statement2) == 0
示例#8
0
    def test_s3_default(self):
        teller = ATM(s3_cache_dir)
        r = teller.get_cache(url)
        r = teller.get_cache(url2)

        statement1 = teller.statement()

        # now delete
        teller.default()

        # statement again
        statement2 = teller.statement()

        # remove files
        teller.default()

        assert len(statement1) == 2 and len(statement2) == 0
示例#9
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_local_default(self):
    teller = ATM(local_cache_dir)
    r = teller.get_cache(url)
    r = teller.get_cache(url2)

    statement1 = teller.statement()

    # now delete
    teller.default()

    # statement again
    statement2 = teller.statement()

    # remove cache directory
    shutil.rmtree(local_cache_dir)

    assert len(statement1) == 2 and len(statement2) == 0
示例#10
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_s3_default(self):
    teller = ATM(s3_cache_dir)
    r = teller.get_cache(url)
    r = teller.get_cache(url2)

    statement1 = teller.statement()

    # now delete
    teller.default()

    # statement again
    statement2 = teller.statement()

    # remove files
    teller.default()

    assert len(statement1) == 2 and len(statement2) == 0
示例#11
0
    def test_s3_interval(self):
        teller = ATM(s3_cache_dir, interval=10)

        # remove cache directory
        teller.default()

        r = teller.get_cache(url)
        r = teller.get_cache(url)

        time.sleep(10)

        r = teller.get_cache(url)

        statement = teller.statement()

        # remove cache directory
        teller.default()

        # test
        assert len(statement) == 2
示例#12
0
文件: atm_tests.py 项目: xfLee/atm-1
  def test_s3_interval(self):
    teller = ATM(s3_cache_dir, interval=10)
    
    # remove cache directory
    teller.default()

    r = teller.get_cache(url)
    r = teller.get_cache(url)

    time.sleep(10)

    r = teller.get_cache(url)

    statement = teller.statement()

    # remove cache directory
    teller.default()

    # test
    assert len(statement)==2