コード例 #1
0
 def testCreate(self):
     profile = Profile(ProfileTest.conn)
     profile['advertiser_id'] = 136402
     profile['deal_targets'] = [{'id': 1999}]
     profile['domain_targets'] = [{'domain': 'www.espn.com'}]
     result = profile.create()
     assert result == profile.get('id')
コード例 #2
0
 def testCreate(self):
     profile = Profile(ProfileTest.conn)
     profile['advertiser_id'] = 136402
     profile['deal_targets'] = [{'id': 1999}]
     profile['domain_targets'] = [{'domain': 'www.espn.com'}]
     result = profile.create()
     assert result == profile.get('id')
コード例 #3
0
 def testGetById(self):
     profile_id = 50161408
     advertiser_id = 454980
     loader = Profile(ProfileTest.conn)
     profile = loader.find_one(profile_id, advertiser_id)
     print(profile)
     assert profile_id == profile.get('id')
コード例 #4
0
    def testReauth(self):
        Connection.tmp_file = '/tmp/auth_test.txt'
        tmp_file = open(Connection.tmp_file, 'w')
        tmp_file.write('bad_token')

        profile_id = 423662
        advertiser_id = 136402
        loader = Profile(ReauthTest.conn)
        profile = loader.find_one(profile_id, advertiser_id)

        assert profile is not None
コード例 #5
0
ファイル: campaign.py プロジェクト: arunvsuresh/appnexus-api
    def get_profile(self):
        if self.get('profile_id') > 0:
            if self.profile_obj is None:
                self.profile_obj = Profile(Campaign.connection).find_one(self.get('profile_id'), self.get('advertiser_id'))
        else:
            new_profile = Profile(Campaign.connection)
            new_profile['advertiser_id'] = self.get('advertiser_id')
            new_profile.create()
            self.profile_obj = new_profile
            self['profile_id'] = new_profile.get('id')

        return self.profile_obj
コード例 #6
0
    def testRunSync(self):
        adv_id = 482212
        id = 7292865
        profile_id = 109369442
        inventory_list_id = 23639

        loader = LineItem(NewSyncTest.conn)
        line_item = loader.find_one(id, adv_id)

        line_item = json.loads(line_item)['data']['response']['line-item']
        print(json.dumps(line_item, indent=2))

        loader = Profile(NewSyncTest.conn)
        profile = loader.find_one(profile_id, adv_id)

        profile = json.loads(profile)['data']['response']['profile']
        print(json.dumps(profile, indent=2))

        loader = InventoryList(NewSyncTest.conn)
        inventory_list = loader.find_by_id(inventory_list_id)

        inventory_list = json.loads(
            inventory_list)['data']['response']['inventory-lists'][0]
        print(json.dumps(inventory_list, indent=2))

        loader = InventoryListItem(NewSyncTest.conn)
        inventory_list_items = loader.find_by_list_id(inventory_list['id'])
        print(inventory_list_items)

        loader = InventoryListItem(NewSyncTest.conn,
                                   {'id': inventory_list['id']})
        loader.set_domains(['www.espn.com', 'eman.com', 'e-man.com'])
        print(loader.save())
コード例 #7
0
ファイル: campaign.py プロジェクト: arunvsuresh/appnexus-api
    def get_profile(self):
        if self.get('profile_id') > 0:
            if self.profile_obj is None:
                self.profile_obj = Profile(Campaign.connection).find_one(
                    self.get('profile_id'), self.get('advertiser_id'))
        else:
            new_profile = Profile(Campaign.connection)
            new_profile['advertiser_id'] = self.get('advertiser_id')
            new_profile.create()
            self.profile_obj = new_profile
            self['profile_id'] = new_profile.get('id')

        return self.profile_obj
コード例 #8
0
 def testGetById(self):
     profile_id = 423662
     advertiser_id = 136402
     loader = Profile(ProfileTest.conn)
     profile = loader.find_one(profile_id, advertiser_id)
     assert profile_id == profile.get('id')
コード例 #9
0
 def testGet(self):
     loader = Profile(ProfileTest.conn)
     profiles = loader.find()
     for profile in profiles:
         assert profile.get('id') is not None
コード例 #10
0
 def testGetById(self):
     profile_id = 423662
     advertiser_id = 136402
     loader = Profile(ProfileTest.conn)
     profile = loader.find_one(profile_id, advertiser_id)
     assert profile_id == profile.get('id')
コード例 #11
0
 def testGet(self):
     loader = Profile(ProfileTest.conn)
     profiles = loader.find()
     for profile in profiles:
         assert profile.get('id') is not None
コード例 #12
0
ファイル: campaign.py プロジェクト: accuenmedia/appnexus-api
    def get_profile(self):
        self.profile_obj = json.loads(
            Profile(Campaign.connection).find_one(
                self.data.get('profile_id'), self.data.get('advertiser_id')))

        return self.profile_obj