Esempio n. 1
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"
Esempio n. 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"
Esempio n. 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
Esempio n. 4
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
Esempio n. 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
Esempio n. 6
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 
Esempio n. 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
Esempio n. 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
Esempio n. 9
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
Esempio n. 10
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
Esempio n. 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
Esempio n. 12
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