def test_update_location(id): anon = Agent() location = Location(id) data = anon.update(location) Location.clear_cache()
def test_update_location(login, password, id): agent = AgentAccount(login, password) location = Location(id) data = agent.update(location) Location.clear_cache()
def test_get_media_location(agent, delay, settings, count, id): location = Location(id) data, pointer = agent.get_media(location, count=count, delay=delay, settings=settings) assert min(location.media_count, count) == len(data) assert (pointer is None) == (location.media_count <= count)
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()
async def test_async_update_location(async_agent, settings, id): location = Location(id) data = await async_agent.update(location, settings=settings) assert not data is None assert not location.id is None assert not location.slug is None assert not location.name is None assert not location.has_public_page is None assert not location.coordinates is None assert not location.media_count is None
def test_get_media_location_pointer(agent_account, delay, settings, count, id): location = Location(id) pointer = None data = [] for _ in range(count): tmp, pointer = agent_account.get_media(location, pointer=pointer, settings=settings) sleep(delay) data.extend(tmp) assert (pointer is None) == (location.media_count == len(data))
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()