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
def test_local_liquidate(self): teller = ATM(local_cache_dir) r = teller.get_cache(url) r = teller.get_cache(url2) files = [f for f in teller.liquidate()] # remove cache directory shutil.rmtree(local_cache_dir) assert len(files) == 2
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"
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"
def test_local_statement(self): teller = ATM(local_cache_dir) r = teller.get_cache(url) r = teller.get_cache(url2) # statement statement = teller.statement() # remove cache directory shutil.rmtree(local_cache_dir) assert len(statement) == 2
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
def test_s3_get(self): teller = ATM(s3_cache_dir) s3_content = teller.get_cache(s3_file).content requests_content = requests.get(s3_file).content assert s3_content == requests_content
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
def test_local_interval(self): teller = ATM(local_cache_dir, interval=10) r = teller.get_cache(url) r = teller.get_cache(url) time.sleep(10) r = teller.get_cache(url) statement = teller.statement() # remove cache directory shutil.rmtree(local_cache_dir) # test assert len(statement)==2
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
def test_local_interval(self): teller = ATM(local_cache_dir, interval=10) r = teller.get_cache(url) r = teller.get_cache(url) time.sleep(10) r = teller.get_cache(url) statement = teller.statement() # remove cache directory shutil.rmtree(local_cache_dir) # test assert len(statement) == 2
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
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