Example #1
0
def fx_test_entries():
    entry1 = Entry(
        id='http://feed.com/entry1', title=Text(value='new1'),
        updated_at=datetime.datetime(2013, 1, 1, 0, 0, 0, tzinfo=utc))
    entry2 = Entry(
        id='http://feed.com/entry2', title=Text(value='new2'),
        updated_at=datetime.datetime(2013, 1, 1, 0, 0, 1, tzinfo=utc))
    return entry1, entry2
Example #2
0
def fx_entries():
    entries = [
        Entry(title='entry {0}'.format(i),
              updated_at=timestamp(i),
              id='urn:uuid:{0}'.format(uuid.uuid4())) for i in xrange(10)
    ]
    return entries
Example #3
0
def fx_test_feeds():
    authors = [Person(name='vio')]
    feed = Feed(id='http://feedone.com/',
                authors=authors,
                title='Feed One',
                updated_at=datetime.datetime(2013,
                                             10,
                                             29,
                                             20,
                                             55,
                                             30,
                                             tzinfo=utc))
    updated_feed = Feed(id='http://feedone.com/',
                        authors=authors,
                        title=Text(value='Feed One'),
                        updated_at=datetime.datetime(2013,
                                                     10,
                                                     30,
                                                     20,
                                                     55,
                                                     30,
                                                     tzinfo=utc))
    entry = Entry(id='http://feedone.com/1',
                  authors=authors,
                  title=Text(value='Test Entry'),
                  updated_at=datetime.datetime(2013,
                                               10,
                                               30,
                                               20,
                                               55,
                                               30,
                                               tzinfo=utc))
    updated_feed.entries.append(entry)
    return feed, updated_feed
Example #4
0
def fx_filtering_entries(fx_test_stage):
    authors = [Person(name='vio')]
    now = datetime.datetime(2013, 10, 30, 20, 55, 30, tzinfo=utc)
    feed = Feed(id='http://feedone.com/feed/atom/', authors=authors,
                title=Text(value='Feed One'),
                updated_at=now)
    for i in range(10):
        feed.entries.append(
            Entry(id='http://feedone.com/feed/atom/' + str(i) + '/',
                  authors=authors,
                  title=Text(value=str(i + 1)),
                  updated_at=now + datetime.timedelta(days=1) * i)
        )
    for i in range(5):
        feed.entries[i].read = Mark(marked=True, updated_at=now)
    for i in range(3, 7):
        feed.entries[i].starred = Mark(marked=True, updated_at=now)
    with fx_test_stage as stage:
        stage.feeds[get_hash('http://feedone.com/feed/atom/')] = feed
        stage.subscriptions = read(SubscriptionList, opml_for_filtering)
Example #5
0
def test_entry_str():
    assert text_type(Entry(title=Text(value='Title desu'))) == 'Title desu'
    assert text_type(Entry()) == ''
Example #6
0
def xmls_for_next(request, fx_test_stage):
    opml = '''
    <opml version="1.0">
      <head>
        <title>test opml</title>
      </head>
      <body>
        <outline text="categoryone" title="categoryone">
            <outline type="atom" text="Feed One" title="Feed One"
            xmlUrl="http://feedone.com/" />
            <outline type="atom" text="Feed Two" title="Feed Two"
            xmlUrl="http://feedtwo.com/" />
        </outline>
        <outline type="atom" text="Feed Three" title="Feed Three"
        xmlUrl="http://feedthree.com/" />
        <outline type="atom" text="Feed Four" title="Feed Three"
        xmlUrl="http://feedthree.com/" />
      </body>
    </opml>
    '''
    authors = [Person(name='vio')]
    feed_one = Feed(id='http://feedone.com/', authors=authors,
                    title=Text(value='Feed One'),
                    updated_at=datetime.datetime(2013, 10, 30, 20, 55, 30,
                                                 tzinfo=utc))
    feed_two = Feed(id='http://feedtwo.com/', authors=authors,
                    title=Text(value='Feed Two'),
                    updated_at=datetime.datetime(2013, 10, 30, 21, 55, 30,
                                                 tzinfo=utc))
    feed_three = Feed(id='http://feedthree.com/', authors=authors,
                      title=Text(value='Feed Three'),
                      updated_at=datetime.datetime(2013, 10, 30, 21, 55, 30,
                                                   tzinfo=utc))
    feed_four = Feed(id='http://feedfour.com/', authors=authors,
                     title=Text(value='Feed Four'),
                     updated_at=datetime.datetime(2013, 10, 30, 21, 55, 30,
                                                  tzinfo=utc))
    for i in range(25):
        feed_one.entries.append(
            Entry(id='http://feedone.com/' + str(24 - i),
                  authors=authors,
                  title=Text(value='Feed One: Entry ' + str(24 - i)),
                  updated_at=datetime.datetime(2013, 10, 30, 20, 55, 30,
                                               tzinfo=utc) +
                  datetime.timedelta(days=-1)*i)
        )
        feed_two.entries.append(
            Entry(id='http://feedtwo.com/' + str(24 - i),
                  authors=authors,
                  title=Text(value='Feed Two: Entry ' + str(24 - i)),
                  updated_at=datetime.datetime(2013, 10, 30, 19, 55, 30,
                                               tzinfo=utc) +
                  datetime.timedelta(days=-1)*i)
        )
    for i in range(20):
        feed_three.entries.append(
            Entry(id='http://feedthree.com/' + str(19 - i),
                  authors=authors,
                  title=Text(value='Feed Three: Entry ' + str(19 - i)),
                  updated_at=datetime.datetime(2013, 10, 30, 20, 55, 30,
                                               tzinfo=utc) +
                  datetime.timedelta(days=-1)*i)
        )
    for i in range(50):
        feed_four.entries.append(
            Entry(id='http://feedfour.com/' + str(49 - i),
                  authors=authors,
                  title=Text(value='Feed Four: Entry ' + str(49 - i)),
                  updated_at=datetime.datetime(2013, 10, 30, 20, 55, 30,
                                               tzinfo=utc) +
                  datetime.timedelta(days=-1)*i)
        )
    for i in range(5):
        feed_two.entries[i].read = True
        feed_two.entries[i+15].read = True
    for i in range(20, 50):
        feed_four.entries[i].read = True
    subscriptions = read(SubscriptionList, opml)
    with fx_test_stage as stage:
        stage.subscriptions = subscriptions
        stage.feeds[get_hash('http://feedone.com/')] = feed_one
        stage.feeds[get_hash('http://feedtwo.com/')] = feed_two
        stage.feeds[get_hash('http://feedthree.com/')] = feed_three
        stage.feeds[get_hash('http://feedfour.com/')] = feed_four