Пример #1
0
    def test_t007_wad_Budget_save(self):

        print('wad_Budget test t007')

        # save a new instance

        newbudget0 = Budget(budgetname='test007_budget0name0')
        newbudget0.save()

        newbudget0.delete()
Пример #2
0
    def test_t006_wad_Budget_pre_init(self):

        print('wad_Budget test t006')

        newbudget0 = Budget(budgetname='test006_budget0name0')
        newbudget0.save()

        # try to init a new budget with the same name as the previous budget
        with self.assertRaises(suds.WebFault):
            newbudget1 = Budget(budgetname='test006_budget0name0')
            newbudget1.save()

        newbudget0.delete()
Пример #3
0
    def test_t008_wad_Budget_save_update(self):

        print('wad_Budget test t008')

        client = adwords.AdWordsClient.LoadFromStorage()

        # test budget name modification #

        # create a budget with a name
        newbudget0 = Budget(budgetname='test008_budget0name0')
        newbudget0.save()

        # check that the name is correct
        aw_budget = Budget.getbudget(client, newbudget0.budgetid)
        self.assertEqual(aw_budget['name'], 'test008_budget0name0')

        # change the name
        newbudget0.budgetname = 'test008_budget0name0_modified'
        newbudget0.save()

        # check that the name change is correct
        aw_budget = Budget.getbudget(client, newbudget0.budgetid)
        self.assertEqual(aw_budget['name'], 'test008_budget0name0_modified')

        # test budget amount modification #

        # create a budget with an amount
        newbudget1 = Budget(budgetname='test008_budget1name1',
                            budgetamount='50000000')
        newbudget1.save()

        # check that the amount is correct
        aw_budget = Budget.getbudget(client, newbudget1.budgetid)
        self.assertEqual(int(aw_budget['amount']['microAmount']), 50000000)

        # change the amount
        newbudget1.budgetamount = '60000000'
        newbudget1.save()

        # check that the amount change is correct
        aw_budget = Budget.getbudget(client, newbudget1.budgetid)
        self.assertEqual(int(aw_budget['amount']['microAmount']), 60000000)

        # clean up
        newbudget0.delete()
        newbudget1.delete()