def testCreate(self):
     d_list = DomainList(DomainListTest.conn)
     d_list['name'] = "domain list test"
     d_list['description'] = "domain list test description"
     d_list['domains'] = ['www.espn.com', 'www.cnn.com']
     result = d_list.create()
     assert result == d_list.get('id')
示例#2
0
    def get_domain_lists(self):
        profile = self.get_profile()
        list_ids = profile.get('domain_list_targets')

        loader = DomainList(Campaign.connection)
        rval = []
        for list_id in list_ids:
            rval.append(loader.find(list_id.get('id')))
        return rval
示例#3
0
    def get_domain_lists(self):
        profile = self.get_profile()
        list_ids = profile.get('domain_list_targets')

        loader = DomainList(Campaign.connection)
        rval = []
        for list_id in list_ids:
            rval.append(loader.find(list_id.get('id')))
        return rval
    def testSearch(self):
        rand = random.randint(1, 100000)

        name = "domain list test " + str(rand)

        d_list = DomainList(DomainListTest.conn)
        d_list['name'] = name
        d_list['description'] = "domain list test description"
        d_list['domains'] = ['www.espn.com', 'www.cnn.com']
        result = d_list.create()
        assert result == d_list.get('id')

        loader = DomainList(DomainListTest.conn)
        d_list_found = loader.find_by_name(name)

        assert d_list.get('id') == d_list_found.get('id')
示例#5
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)