File: test_parse_feed.py

package info (click to toggle)
gnome-feeds 2.2.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,524 kB
  • sloc: python: 5,369; sh: 93; xml: 28; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from pathlib import Path
from .sample_rss import SAMPLE_RSS
from gfeeds.feed_parser import parse_feed
from os import remove
import pytest


RSS_PATH = '/tmp/org.gabmus.gfeeds.test.parse_feed.rss'


@pytest.fixture(autouse=True)
def run_around_tests():
    with open(RSS_PATH, 'w') as fd:
        fd.write(SAMPLE_RSS)
    yield
    remove(RSS_PATH)


def test_parse_feed():
    res = parse_feed(Path(RSS_PATH))
    assert not res.is_null
    assert res.error is None
    assert res.title == 'GabMus\'s Dev Log'
    assert res.description == 'Recent content on GabMus\'s Dev Log'
    assert res.image_url == 'https://gabmus.org/logo.svg'
    assert res.link == 'https://gabmus.org/'
    assert res.rss_link == 'https://gabmus.org/index.xml'
    assert len(res.raw_entries) == 5