Beispiel #1
0
def test_category_entries_filtering(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/entries/?read=False')
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
Beispiel #2
0
def test_category_entries_filtering(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/entries/?read=False')
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
Beispiel #3
0
def test_feed_with_20_entries(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/feeds/' + get_hash('http://feedthree.com/') +
                       '/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        assert r.status_code == 200
        result = json.loads(r.data)
        assert not result['entries']
        assert not result['next_url']
Beispiel #4
0
def test_feed_with_20_entries(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/feeds/' + get_hash('http://feedthree.com/') +
                       '/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        assert r.status_code == 200
        result = json.loads(r.data)
        assert not result['entries']
        assert not result['next_url']
Beispiel #5
0
def test_feed_entries_filtering(make_empty, xmls_for_next):
    with app.test_client() as client:
        feed_id = get_hash('http://feedfour.com/')
        r = client.get('/feeds/' + feed_id + '/entries/?read=False')
        assert r.status_code == 200
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
Beispiel #6
0
def test_feed_entries_filtering(make_empty, xmls_for_next):
    with app.test_client() as client:
        feed_id = get_hash('http://feedfour.com/')
        r = client.get('/feeds/' + feed_id + '/entries/?read=False')
        assert r.status_code == 200
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        for entry in result['entries']:
            assert entry['read'] is False
Beispiel #7
0
def test_request_same_feed(make_empty, xmls_for_next):
    with app.test_client() as client:
        r1 = client.get('/-categoryone/feeds/' +
                        get_hash('http://feedone.com/') + '/entries/')
        r2 = client.get('/-categoryone/feeds/' +
                        get_hash('http://feedone.com/') + '/entries/')
        r1_result = json.loads(r1.data)
        r2_result = json.loads(r2.data)
        r1_next = client.get(r1_result['next_url'])
        if make_empty:
            entry_generators.clear()
        r2_next = client.get(r2_result['next_url'])
        r1_result = json.loads(r1_next.data)
        r2_result = json.loads(r2_next.data)
        assert r1_result['entries'] == r2_result['entries']
Beispiel #8
0
def test_feed_entries_next(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/feeds/' +
                       get_hash('http://feedone.com/') + '/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed One: Entry 5'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 5
        assert result['entries'][-1]['title'] == 'Feed One: Entry 0'
        assert not result['next_url']
Beispiel #9
0
def test_request_same_feed(make_empty, xmls_for_next):
    with app.test_client() as client:
        r1 = client.get('/-categoryone/feeds/' +
                        get_hash('http://feedone.com/') +
                        '/entries/')
        r2 = client.get('/-categoryone/feeds/' +
                        get_hash('http://feedone.com/') +
                        '/entries/')
        r1_result = json.loads(r1.data)
        r2_result = json.loads(r2.data)
        r1_next = client.get(r1_result['next_url'])
        if make_empty:
            entry_generators.clear()
        r2_next = client.get(r2_result['next_url'])
        r1_result = json.loads(r1_next.data)
        r2_result = json.loads(r2_next.data)
        assert r1_result['entries'] == r2_result['entries']
Beispiel #10
0
def test_feed_entries_next(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/feeds/' +
                       get_hash('http://feedone.com/') +
                       '/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed One: Entry 5'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 5
        assert result['entries'][-1]['title'] == 'Feed One: Entry 0'
        assert not result['next_url']
Beispiel #11
0
def test_category_entries_next(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 15'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 5'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        assert len(result['entries']) == 10
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 0'
Beispiel #12
0
def test_category_entries_next(make_empty, xmls_for_next):
    with app.test_client() as client:
        r = client.get('/-categoryone/entries/')
        assert r.status_code == 200
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 15'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        assert len(result['entries']) == 20
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 5'
        if make_empty:
            entry_generators.clear()
        r = client.get(result['next_url'])
        result = json.loads(r.data)
        assert len(result['entries']) == 10
        assert result['entries'][-1]['title'] == 'Feed Two: Entry 0'