Пример #1
0
def test_rts(rts_host):
    COUNT = 5
    request = req.RecsRequest(site_id='75471913db291cdd62f3092709061407',
                              bsin='29c08e54-c44b-45d6-9f91-3f7597421442',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=1.0,
                                                              max_=None),
                                    values=['trending'],
                                    field='resource-type',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups['hotel'] = req.RecGroupRequest(count=COUNT,
                                                  metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #2
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='12813b8b61d75410d6b804eb6ab73f4d',
                              bsin='86183de5-99cd-4e97-900a-5262e97d3870',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #3
0
def test_rts(rts_host):
    COUNT = 5
    request = req.RecsRequest(site_id='kob-hubbard-tv',
                              bsin='4b91521f-7598-4efe-97f6-0fe352fe0a6f',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=1.0,
                                                              max_=None),
                                    values=['New%20Mexico%20News'],
                                    field='section',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups['hotel'] = req.RecGroupRequest(count=COUNT,
                                                  metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #4
0
def test_rts(rts_host):
    COUNT = 5
    request = req.RecsRequest(site_id='patient-info-prod',
                              bsin='8a8a1d17-8029-491e-9ed6-e5ed659a4005',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        or_=None,
        range=None,
        and_=[
            recs_filter.TFilter(or_=None,
                                range=None,
                                and_=None,
                                existence=None,
                                overlap=None,
                                any=None,
                                recency=None,
                                named='GLOBAL'),
            recs_filter.TFilter(or_=None,
                                range=None,
                                and_=None,
                                existence=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(max_=None,
                                                              min_=1.0),
                                    match_type=0,
                                    field='resource-type',
                                    values=['Wellbeing']),
                                any=None,
                                recency=None,
                                named=None)
        ],
        existence=None,
        overlap=None,
        any=None,
        recency=None,
        named=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #5
0
def test_rts(rts_host):
    COUNT = 10
    request = req.RecsRequest(site_id='0eddb34d4eb4be1df2b4160ec047aa73',
                              bsin='4c3adc65-0e68-4a1e-9448-ecdce79fe7ee',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=1.0,
                                                              max_=None),
                                    values=['article'],
                                    field='resource-type',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups['article'] = req.RecGroupRequest(count=COUNT,
                                                    metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #6
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='d14efd1c5848089137af10c7ee78252e',
                              bsin='19b0ed4f-eb3f-4d4c-a876-86ba86e2033d',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #7
0
def test_rts(rts_host):
    COUNT = 15
    request = req.RecsRequest(site_id='wide-open-spaces',
                              bsin='97b61121-34bf-4c00-ab2e-57fcecba05f0',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        or_=None,
        range=None,
        and_=[
            recs_filter.TFilter(or_=None,
                                range=None,
                                and_=None,
                                existence=None,
                                overlap=None,
                                any=None,
                                recency=None,
                                named='GLOBAL'),
            recs_filter.TFilter(or_=None,
                                range=None,
                                and_=None,
                                existence=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(max_=None,
                                                              min_=1.0),
                                    match_type=0,
                                    field='resource-type',
                                    values=['all']),
                                any=None,
                                recency=None,
                                named=None)
        ],
        existence=None,
        overlap=None,
        any=None,
        recency=None,
        named=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #8
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='eea9006861e426c0e2efb4f432e697d7',
                              bsin='406dcdee-4197-4b58-ab1b-3cbd6f3b7473',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #9
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='64c06b289b11f0f1d36bf7f896abdf8b',
                              bsin='498be1b8-5a60-4ecb-b598-05068eac7267',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #10
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='5d29921c2b8b2d6fb309bcf08c26f9f9',
                              bsin='cd0c1b08-2b94-4bf5-ad21-4d3d259cf870',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #11
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='computerworld-uk',
                              bsin='7e797bc8-47a8-4d98-b657-f8c26c6c6bdc',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #12
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='4c9d8da16dcdf0ae67be507cea7e82d7',
                              bsin='490248c3-4cce-4424-93d5-c326e13817aa',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        existence=None,
        and_=[
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=None,
                                any=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(existence=None,
                                and_=None,
                                or_=None,
                                recency=None,
                                overlap=recs_filter.TOverlapFilter(
                                    amount=recs_filter.TRange(min_=None,
                                                              max_=0.0),
                                    values=['game'],
                                    field='model',
                                    match_type=0),
                                any=None,
                                named=None,
                                range=None)
        ],
        or_=None,
        recency=None,
        overlap=None,
        any=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #13
0
def test_metafilter_rappler():
    site_id = '1a1e951c0be6ac5f7a57c617f1160972'

    request = req.RecsRequest(site_id=site_id,
                              bsin=BSIN,
                              seeds=['article|156222'],
                              excludes=['article|156222'],
                              recset_id='7aa96f3a-c7a5-11e6-b95c-0e62f196a588',
                              test=False)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['Nigeria', 'Gombe'],
                field='keywords',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': HOST, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
    for r in response:
        print(r)
Пример #14
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='snopes',
                              bsin='50a46296-8a91-4c7a-bf0b-4f1a15b3ac33',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        existence=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                existence=None,
                                recency=None,
                                and_=None,
                                range=None,
                                or_=None,
                                any=None,
                                named='GLOBAL'),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                match_type=0,
                amount=recs_filter.TRange(max_=None, min_=1.0)),
                                existence=None,
                                recency=None,
                                and_=None,
                                range=None,
                                or_=None,
                                any=None,
                                named=None)
        ],
        range=None,
        or_=None,
        any=None,
        named=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #15
0
def test_rts(rts_host):

    request = req.RecsRequest(site_id='883617d0eb6793113323ba5e36470778',
                              bsin=BSIN,
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(existence=None, and_=[recs_filter.TFilter(existence=None, and_=None, or_=None, recency=None, overlap=None, any=None, named='GLOBAL', range=None), recs_filter.TFilter(existence=None, and_=None, or_=None, recency=recs_filter.TRecencyFilter(range=recs_filter.TRange(min_=-604800.0, max_=None), field='pubDate'), overlap=None, any=None, named=None, range=None), recs_filter.TFilter(existence=None, and_=None, or_=None, recency=None, overlap=recs_filter.TOverlapFilter(amount=recs_filter.TRange(min_=1.0, max_=None), values=['article_alist'], field='resource-type', match_type=0), any=None, named=None, range=None)], or_=None, recency=None, overlap=None, any=None, named=None, range=None)

    request.groups['articles'] = req.RecGroupRequest(count=COUNT, metafilter=metafilter)

    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #16
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(
        site_id='4e95f0debe3619d4e92b1b9828f17942',
        bsin='4deef5a5-d5c9-4b9e-94f6-f67e394405cd',
        #bsin='19620e18-7694-4772-a743-992e99ac1c92',
        seeds=EMPTY_SEEDS,
        excludes=EMPTY_EXCLUDES,
        recset_id=RECSET_ID,
        test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #17
0
def test_rts(rts_host):
    request = req.RecsRequest(site_id='long-beach-post',
                              bsin='e1fb9080-f54f-47cd-923a-ae6d6d9342a0',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    COUNT1 = 10
    metafilter = recs_filter.TFilter(
        overlap=None,
        existence=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                existence=None,
                                recency=None,
                                and_=None,
                                range=None,
                                or_=None,
                                any=None,
                                named='GLOBAL'),
            recs_filter.TFilter(overlap=None,
                                existence=None,
                                recency=recs_filter.TRecencyFilter(
                                    range=recs_filter.TRange(max_=None,
                                                             min_=-86400.0),
                                    field='pubDate'),
                                and_=None,
                                range=None,
                                or_=None,
                                any=None,
                                named=None)
        ],
        range=None,
        or_=None,
        any=None,
        named=None)
    request.groups['featured'] = req.RecGroupRequest(count=COUNT1,
                                                     metafilter=metafilter)

    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT1
Пример #18
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(
        site_id='53a9d86b81ee7fe4451218e0f95e2136',
        bsin='af227b18-6c21-4010-83a0-8d2769e4d424',
        # bsin='d32c9e0c-e28d-4dbd-8ad9-e3fe07353edf',
        seeds=EMPTY_SEEDS,
        excludes=EMPTY_EXCLUDES,
        recset_id=RECSET_ID,
        test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['business'],
                field='keywords',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #19
0
def test_metafilter_resource_type_article_abs():
    COUNT = 4
    request = req.RecsRequest(
        site_id='atlanta-black-star',
        bsin='0d212f35-b51c-4df3-b054-6d830cdd12da',
        #bsin='f6cb11da-3342-4849-a098-2efe94f8e80e',
        seeds=EMPTY_SEEDS,
        excludes=EMPTY_EXCLUDES,
        recset_id=RECSET_ID,
        test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': HOST, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #20
0
def test_rts(rts_host):

    request = req.RecsRequest(site_id='hubspot-blog',
                              bsin=BSIN,
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['Marketing'],
                field='keywords',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups['default'] = req.RecGroupRequest(count=COUNT,
                                                    metafilter=metafilter)

    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == 4
Пример #21
0
def test_metafilter_resource_type_article(customer_name, site_id):

    request = req.RecsRequest(site_id=site_id,
                              bsin=BSIN,
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            #recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(values=['文章'], field='resource-type', amount=recs_filter.TRange(min_=1.0, max_=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': HOST, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #22
0
def test_metafilter_resource_type_article_abs():
    COUNT = 4
    request = req.RecsRequest(site_id='cyber-creations',
                              bsin='0d53ad70-f847-425e-b09e-839a487093b3',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    td = timedelta(days=-4).total_seconds()
    metafilter = recs_filter.TFilter(overlap=None, recency=None, and_=[
        recs_filter.TFilter(overlap=None, recency=None, and_=None, existence=None, or_=None, named='GLOBAL', range=None),
        recs_filter.TFilter(overlap=None, recency=recs_filter.TRecencyFilter(field='pubDate', range=recs_filter.TRange(min_=td, max_=None)), and_=None, existence=None, or_=None, named=None, range=None)], existence=None, or_=None, named=None, range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT, metafilter=metafilter)
    config = {'host': HOST, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #23
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='moneymagpie',
                              bsin='c441e571-8911-4856-8096-34f8108690f6',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['business'],
                field='keywords',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #24
0
def test_metafilter_resource_type_article_abs():
    COUNT = 4
    request = req.RecsRequest(site_id='2a9897b9f56088c2916bb3403cfff631',
                              bsin='ec5e00d4-6386-4cf7-a1d1-ea0e4f7d8a8c',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': HOST, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #25
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='774367e2d0fa1515ca1e3580188b7d03',
                              bsin='92060a74-291d-4314-a4a9-4d7cfa0e11bc',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['game'],
                field='model',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #26
0
def test_rts(rts_host):
    COUNT = 3
    request = req.RecsRequest(site_id='3c499a166380645f83154eb95983ed96',
                              bsin='d3555efd-fc91-418c-a566-25c20ca31212',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    td = timedelta(days=-2).total_seconds()
    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=None,
                                recency=recs_filter.TRecencyFilter(
                                    field='pubDate',
                                    range=recs_filter.TRange(min_=td,
                                                             max_=None)),
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #27
0
def test_rts(rts_host):
    COUNT = 3
    request = req.RecsRequest(site_id='herb',
                              bsin='46d9f11f-9e8c-4bd5-be21-739515aebc66',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    td = timedelta(days=-2).total_seconds()
    metafilter = recs_filter.TFilter(overlap=None, recency=None, and_=[
        recs_filter.TFilter(overlap=None, recency=None, and_=None, existence=None, or_=None, named='GLOBAL', range=None)
        ], existence=None, or_=None, named=None, range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT, metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #28
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='abril-vip',
                              bsin='a17f00dd-32d7-40f4-8b5d-4522de4202b7',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['article'],
                field='resource-type',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #29
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='wide-open-country',
                              bsin='47e8caf8-602f-43fd-af1a-d55f7ac1e93a',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    td = timedelta(days=-4).total_seconds()
    metafilter = recs_filter.TFilter(overlap=None, recency=None, and_=[
        recs_filter.TFilter(overlap=None, recency=None, and_=None, existence=None, or_=None, named='GLOBAL', range=None),
        recs_filter.TFilter(overlap=None, recency=recs_filter.TRecencyFilter(field='pubDate', range=recs_filter.TRange(min_=td, max_=None)), and_=None, existence=None, or_=None, named=None, range=None)], existence=None, or_=None, named=None, range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT, metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT
Пример #30
0
def test_rts(rts_host):
    COUNT = 4
    request = req.RecsRequest(site_id='bfdc29f674d9fe30e028edb8e9cc5095',
                              bsin='6331a058-fb5b-489f-be4c-93f598bc967c',
                              seeds=EMPTY_SEEDS,
                              excludes=EMPTY_EXCLUDES,
                              recset_id=RECSET_ID,
                              test=TEST)

    metafilter = recs_filter.TFilter(
        overlap=None,
        recency=None,
        and_=[
            recs_filter.TFilter(overlap=None,
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named='GLOBAL',
                                range=None),
            recs_filter.TFilter(overlap=recs_filter.TOverlapFilter(
                values=['business'],
                field='keywords',
                amount=recs_filter.TRange(min_=1.0, max_=None),
                match_type=0),
                                recency=None,
                                and_=None,
                                existence=None,
                                or_=None,
                                named=None,
                                range=None)
        ],
        existence=None,
        or_=None,
        named=None,
        range=None)

    request.groups[GROUP_NAME] = req.RecGroupRequest(count=COUNT,
                                                     metafilter=metafilter)
    config = {'host': rts_host, 'port': PORT, 'timeout': TIMEOUT}
    with RecommendationsClient(calling_app=CALLING_APP, **config) as client:
        response = client.get_recommendations(request)
    assert len(response) == COUNT