Ejemplo n.º 1
0
def test_dry_run(monkeypatch, cli_config):
    client = Client(CUSTOM_TARGETING, BIDDER_VIDEO_SVC_IDS)
    monkeypatch.setattr(ad_manager.AdManagerClient, "LoadFromString", lambda x: client)
    gam = GAMConfig()
    gam.create_line_items()
    gam.cleanup()

    assert len(gam.li_objs) == 1
    assert load_file('tests/resources/video_expected_dry_run.yml') == \
      gam.li_objs[0].line_items
    assert DRY_RUN_EXPECTED_LICA == gam.lica_objs
Ejemplo n.º 2
0
def test_archive_error(caplog, monkeypatch, cli_config):
    class ThisClient(Client):
        def performOrderAction(self, *args):
            return dict(numChanges=0)

    client = ThisClient(CUSTOM_TARGETING, BIDDER_VIDEO_SVC_IDS)
    monkeypatch.setattr(ad_manager.AdManagerClient, "LoadFromString", lambda x: client)
    caplog.set_level(ERROR)
    gam = GAMConfig()
    gam.create_line_items()
    gam.cleanup()

    assert 'Order archive, [6001], of 1 changes, reported 0 changes' in caplog.text
Ejemplo n.º 3
0
def test_video_single_order(monkeypatch, cli_config):
    svc_ids = copy.deepcopy(SINGLE_ORDER_SVC_IDS)
    svc_ids.update(SINGLE_ORDER_VIDEO_SVC_IDS)
    client = Client(CUSTOM_TARGETING, svc_ids)
    monkeypatch.setattr(ad_manager.AdManagerClient, "LoadFromString", lambda x: client)
    gam = GAMConfig()
    gam.create_line_items()

    assert gam.network['displayName'] == "Video Publisher"
    assert len(gam.li_objs) == 1
    assert load_file('tests/resources/video_single_order_expected.yml') == \
      gam.li_objs[0].line_items
    assert EXPECTED_LICA == gam.lica_objs
    gam.cleanup()