def test_update_location(id): anon = Agent() location = Location(id) data = anon.update(location) Location.clear_cache()
def setup_function(): Account.clear_cache() Comment.clear_cache() Location.clear_cache() Media.clear_cache() Story.clear_cache() Tag.clear_cache()
def test_update_location(login, password, id): agent = AgentAccount(login, password) location = Location(id) data = agent.update(location) Location.clear_cache()
def setup_function(): Account.clear_cache() Media.clear_cache() Location.clear_cache() Tag.clear_cache() if not anon["global_delay"] is None: min_delay = anon["global_delay"].get("min", 0) max_delay = anon["global_delay"].get("max", 120) sleep(random() * (max_delay - min_delay) + min_delay)
def test_get_media_location_long(login, password, count, id): agent = AgentAccount(login, password) location = Location(id) data, pointer = agent.get_media(location, count=count) assert (min(location.media_count, count) == len(data)) assert ((pointer is None) == (location.media_count <= count)) Location.clear_cache() Media.clear_cache()
def test_get_media_location_long(count, id): anon = Agent() location = Location(id) data, pointer = anon.get_media(location, count=count) assert (min(location.media_count, count) == len(data)) assert ((pointer is None) == (location.media_count <= count)) Location.clear_cache() Media.clear_cache()
def test_get_media_location_pointer(count, id): anon = Agent() location = Location(id) pointer = None data = [] for i in range(count): tmp, pointer = anon.get_media(location, pointer=pointer) data.extend(tmp) assert ((pointer is None) == (location.media_count <= count)) Location.clear_cache() Media.clear_cache()
def test_get_media_location_pointer(login, password, count, id): agent = AgentAccount(login, password) location = Location(id) pointer = None data = [] for i in range(count): tmp, pointer = agent.get_media(location, pointer=pointer) data.extend(tmp) assert ((pointer is None) == (location.media_count <= count)) Account.clear_cache() Media.clear_cache() Location.clear_cache()
def test_clear_cache_location(): location = Location(1488) Location.clear_cache() assert(Location._cache == dict())
def test_clear_cache_location(id): location = Location(id) assert Location.cache == {id: location} Location.clear_cache() assert Location.cache == dict()