Beispiel #1
0
    def testFlowNewCampaign(self):

        campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        campaign.set_domains(["www.cnn.com"])
        campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(
            470025, 136402)
        assert reloaded_campaign.get_domains() == ['cnn.com']

        reloaded_campaign.set_domains(['www.espn.com'])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(
            470025, 136402)
        assert reloaded_campaign.get_domains() == ['espn.com']

        reloaded_campaign.set_deals([1999])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(
            470025, 136402)
        assert reloaded_campaign.get_deals() == [1999]

        reloaded_campaign.set_deals([1999, 1998])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(
            470025, 136402)
        assert sorted(reloaded_campaign.get_deals()) == sorted([1999, 1998])
    def testFlowNewCampaign(self):

        campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        campaign.set_domains(["www.cnn.com"])
        campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        assert reloaded_campaign.get_domains() == ['cnn.com']

        reloaded_campaign.set_domains(['www.espn.com'])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        assert reloaded_campaign.get_domains() == ['espn.com']

        reloaded_campaign.set_deals([1999])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        assert reloaded_campaign.get_deals() == [1999]

        reloaded_campaign.set_deals([1999, 1998])
        reloaded_campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        assert sorted(reloaded_campaign.get_deals()) == sorted([1999, 1998])
    def testSetDomainList(self):

        campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        domain_list = DomainList(CampaignTest.conn).find(6354)
        campaign.set_domain_lists([domain_list])
        campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        lists = reloaded_campaign.get_domain_lists()

        actual = []
        for domain in lists[0].get('domains'):
            actual.append(domain)

        assert sorted(['espn.com', 'cnn.com']) == sorted(actual)
Beispiel #4
0
    def testSetDomainList(self):

        campaign = Campaign(CampaignTest.conn).find_one(470025, 136402)
        domain_list = DomainList(CampaignTest.conn).find(6354)
        campaign.set_domain_lists([domain_list])
        campaign.save()

        reloaded_campaign = Campaign(CampaignTest.conn).find_one(
            470025, 136402)
        lists = reloaded_campaign.get_domain_lists()

        actual = []
        for domain in lists[0].get('domains'):
            actual.append(domain)

        assert sorted(['espn.com', 'cnn.com']) == sorted(actual)