Beispiel #1
0
def test_remove_category(fx_stages, fx_subscription):
    a, b = fx_stages
    with a:
        s = SubscriptionList()
        c = Category(label='To be deleted')
        c.add(fx_subscription)
        s.add(c)
        a.subscriptions = s
    with a:
        assert c in a.subscriptions
        assert fx_subscription in a.subscriptions.recursive_subscriptions
    with b:
        assert c in b.subscriptions
        assert fx_subscription in b.subscriptions.recursive_subscriptions
    added = Category(label='Added')
    with a:
        a_s = a.subscriptions
        a_s.remove(c)
        a.subscriptions = a_s
        with b:
            b_s = b.subscriptions
            b_s.add(added)
            b.subscriptions = b_s
    with a:
        assert added in a.subscriptions
        assert c not in a.subscriptions
        assert fx_subscription not in a.subscriptions.recursive_subscriptions
    with b:
        assert added in b.subscriptions
        assert c not in b.subscriptions
        assert fx_subscription not in b.subscriptions.recursive_subscriptions
Beispiel #2
0
def test_remove_category(fx_stages, fx_subscription):
    a, b = fx_stages
    with a:
        s = SubscriptionList()
        c = Category(label='To be deleted')
        c.add(fx_subscription)
        s.add(c)
        a.subscriptions = s
    with a:
        assert c in a.subscriptions
        assert fx_subscription in a.subscriptions.recursive_subscriptions
    with b:
        assert c in b.subscriptions
        assert fx_subscription in b.subscriptions.recursive_subscriptions
    added = Category(label='Added')
    with a:
        a_s = a.subscriptions
        a_s.remove(c)
        a.subscriptions = a_s
        with b:
            b_s = b.subscriptions
            b_s.add(added)
            b.subscriptions = b_s
    with a:
        assert added in a.subscriptions
        assert c not in a.subscriptions
        assert fx_subscription not in a.subscriptions.recursive_subscriptions
    with b:
        assert added in b.subscriptions
        assert c not in b.subscriptions
        assert fx_subscription not in b.subscriptions.recursive_subscriptions
Beispiel #3
0
def test_detect_subcategory_changes(fx_stages):
    stage, _ = fx_stages
    subs = SubscriptionList()
    category = Category(label='first-order')
    subcategory = Category(label='second-order')
    category.add(subcategory)
    subs.add(category)
    assert not subs.categories['first-order'].categories['second-order']
    with stage:
        stage.subscriptions = subs
        assert not (stage.subscriptions.categories['first-order']
                                       .categories['second-order'])
    subcategory.add(Category(label='added'))
    assert subs.categories['first-order'].categories['second-order']
    with stage:
        stage.subscriptions = subs
        assert (stage.subscriptions.categories['first-order']
                                   .categories['second-order'])
Beispiel #4
0
def test_detect_subcategory_changes(fx_stages):
    stage, _ = fx_stages
    subs = SubscriptionList()
    category = Category(label='first-order')
    subcategory = Category(label='second-order')
    category.add(subcategory)
    subs.add(category)
    assert not subs.categories['first-order'].categories['second-order']
    with stage:
        stage.subscriptions = subs
        assert not (stage.subscriptions.categories['first-order']
                                       .categories['second-order'])
    subcategory.add(Category(label='added'))
    assert subs.categories['first-order'].categories['second-order']
    with stage:
        stage.subscriptions = subs
        assert (stage.subscriptions.categories['first-order']
                                   .categories['second-order'])
Beispiel #5
0
def xmls(request, fx_test_stage):
    stage = fx_test_stage
    subscriptions = SubscriptionList()
    categoryone = Category(label='categoryone', _title='categoryone')
    categorytwo = Category(label='categorytwo', _title='categorytwo')
    categorythree = Category(label='categorythree', _title='categorythree')
    subscriptions.add(categoryone)
    subscriptions.add(categorythree)
    categoryone.add(categorytwo)
    pair = {
        'http://feedone.com/feed/atom/': categoryone,
        'http://feedtwo.com/feed/atom/': categorytwo,
        'http://feedthree.com/feed/atom/': subscriptions,
        'http://feedfour.com/feed/atom/': categorythree
    }
    generator = crawl(pair.keys(), 4)
    with stage:
        for feed_url, feed, hints in generator:
            sub = pair[feed_url].subscribe(feed)
            stage.feeds[sub.feed_id] = feed
        stage.subscriptions = subscriptions
Beispiel #6
0
def xmls(request, fx_test_stage):
    stage = fx_test_stage
    subscriptions = SubscriptionList()
    categoryone = Category(label='categoryone', _title='categoryone')
    categorytwo = Category(label='categorytwo', _title='categorytwo')
    categorythree = Category(label='categorythree', _title='categorythree')
    subscriptions.add(categoryone)
    subscriptions.add(categorythree)
    categoryone.add(categorytwo)
    pair = {
        'http://feedone.com/feed/atom/': categoryone,
        'http://feedtwo.com/feed/atom/': categorytwo,
        'http://feedthree.com/feed/atom/': subscriptions,
        'http://feedfour.com/feed/atom/': categorythree
    }
    generator = crawl(pair.keys(), 4)
    with stage:
        for feed_url, feed, hints in generator:
            sub = pair[feed_url].subscribe(feed)
            stage.feeds[sub.feed_id] = feed
        stage.subscriptions = subscriptions