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')
 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')
 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')
    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
Beispiel #5
0
    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
Beispiel #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())
Beispiel #7
0
    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
 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')
 def testGet(self):
     loader = Profile(ProfileTest.conn)
     profiles = loader.find()
     for profile in profiles:
         assert profile.get('id') is not None
 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')
 def testGet(self):
     loader = Profile(ProfileTest.conn)
     profiles = loader.find()
     for profile in profiles:
         assert profile.get('id') is not None
Beispiel #12
0
    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