예제 #1
0
def test_update_location(id):
    anon = Agent()
    location = Location(id)

    data = anon.update(location)

    Location.clear_cache()
예제 #2
0
def setup_function():
    Account.clear_cache()
    Comment.clear_cache()
    Location.clear_cache()
    Media.clear_cache()
    Story.clear_cache()
    Tag.clear_cache()
예제 #3
0
def test_update_location(login, password, id):
    agent = AgentAccount(login, password)
    location = Location(id)

    data = agent.update(location)

    Location.clear_cache()
예제 #4
0
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)
예제 #5
0
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()
예제 #6
0
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()
예제 #7
0
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()
예제 #8
0
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()
예제 #9
0
def test_clear_cache_location():
    location = Location(1488)
    
    Location.clear_cache()
    
    assert(Location._cache == dict())
예제 #10
0
def test_clear_cache_location(id):
    location = Location(id)
    assert Location.cache == {id: location}

    Location.clear_cache()
    assert Location.cache == dict()