Ejemplo n.º 1
0
 def test_cancel_subscription_update_called(self):
     z = Zuora(self.zuora_settings)
     z.create_product_amendment = mock.Mock()
     z.update_product_amendment = mock.Mock()
     z.cancel_subscription(subscription_id=mock.Mock())
     assert z.create_product_amendment.call_count == 1
     assert z.update_product_amendment.call_count == 1
Ejemplo n.º 2
0
 def test_subscribe_call_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.make_account = mock.Mock()
     z.make_contact = mock.Mock()
     z.make_rate_plan_data = mock.Mock()
     z.make_subscription = mock.Mock()
     z.call = mock.Mock()
     z.call.return_value = mock.Mock()
     z.subscribe(product_rate_plan_id=mock.Mock(),
                 monthly_term=mock.Mock(),
                 zAccount=None,
                 zContact=None,
                 process_payments_flag=True,
                 generate_invoice_flag=True,
                 generate_preview=False,
                 account_name=mock.Mock(),
                 subscription_name=mock.Mock(),
                 recurring=True,
                 payment_method=mock.Mock(),
                 order_id=mock.Mock(),
                 user=mock.Mock(),
                 billing_address=mock.Mock(),)
     assert z.make_account.call_count == 1
     assert z.make_rate_plan_data.call_count == 1
     assert z.make_subscription.call_count == 1
     assert z.call.call_count == 1
Ejemplo n.º 3
0
 def test_get_invoices_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_invoices(account_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 4
0
 def test_get_contact_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_contact(email='*****@*****.**', account_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 5
0
 def test_get_account_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_account(user_id=42)
     assert z.query.call_count == 1
Ejemplo n.º 6
0
 def test_get_payment_method_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_payment_method(payment_method_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 7
0
 def test_get_contact_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_contact(email='*****@*****.**', account_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 8
0
 def test_get_products_shortcodes(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_products(shortcodes=['sub_bronze', 'sub_gold'])
     assert z.query.call_count == 1
Ejemplo n.º 9
0
 def test_get_payment_method_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_payment_method(payment_method_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 10
0
 def test_get_product_rate_plan_charges_product_rate_plan_id(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_product_rate_plan_charges(product_rate_plan_id='df2423dffgf')
     assert z.query.call_count == 1
Ejemplo n.º 11
0
 def test_get_product_rate_plan_charges_product_rate_plan_id(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_product_rate_plan_charges(product_rate_plan_id='df2423dffgf')
     assert z.query.call_count == 1
Ejemplo n.º 12
0
 def test_get_products_shortcodes(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_products(shortcodes=['sub_bronze', 'sub_gold'])
     assert z.query.call_count == 1
Ejemplo n.º 13
0
 def test_get_invoice_items_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_invoice_items(invoice_id=mock.Mock(),
                         subscription_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 14
0
 def test_get_payment_methods_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_payment_methods(account_id=mock.Mock(),
                           email='*****@*****.**',
                           phone=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 15
0
 def test_get_product_rate_plan_charge_tiers_product_rate_plan_charge_id_list(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_product_rate_plan_charge_tiers(
                     product_rate_plan_charge_id_list=['df2423dffgf',
                                                       'fdsgd234233g'])
     assert z.query.call_count == 1
Ejemplo n.º 16
0
 def test_get_invoice_pdf_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     zInvoice = mock.Mock()
     zInvoice.Body = mock.Mock()
     response.records = [zInvoice]
     z.query.return_value = response
     z.get_invoice_pdf(invoice_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 17
0
 def test_get_payment_methods_get_payment_method_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     zAccount = mock.Mock()
     zAccount.DefaultPaymentMethodId = mock.Mock()
     response.records = [zAccount]
     z.query.return_value = response
     z.get_payment_methods(account_number=mock.Mock())
     assert z.query.call_count == 2
Ejemplo n.º 18
0
 def test_get_invoice_pdf_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     zInvoice = mock.Mock()
     zInvoice.Body = mock.Mock()
     response.records = [zInvoice]
     z.query.return_value = response
     z.get_invoice_pdf(invoice_id=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 19
0
 def test_update_account_update_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.update_account(account_id=mock.Mock(),
                      update_dict={})
     assert z.update.call_count == 1
Ejemplo n.º 20
0
 def test_get_product_rate_plan_charge_tiers_product_rate_plan_charge_id_list(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_product_rate_plan_charge_tiers(
                     product_rate_plan_charge_id_list=['df2423dffgf',
                                                       'fdsgd234233g'])
     assert z.query.call_count == 1
Ejemplo n.º 21
0
 def test_get_payment_methods_get_payment_method_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     zAccount = mock.Mock()
     zAccount.DefaultPaymentMethodId = mock.Mock()
     response.records = [zAccount]
     z.query.return_value = response
     z.get_payment_methods(account_number=mock.Mock())
     assert z.query.call_count == 2
Ejemplo n.º 22
0
 def test_get_payment_methods_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_payment_methods(account_id=mock.Mock(),
                           email='*****@*****.**',
                           phone=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 23
0
 def test_update_product_ammendment_update_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.update_product_amendment(effective_date=mock.Mock(),
                             zAmendment=mock.Mock())
     assert z.update.call_count == 1
Ejemplo n.º 24
0
 def test_subscribe_call_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.make_account = mock.Mock()
     z.make_contact = mock.Mock()
     z.make_rate_plan_data = mock.Mock()
     z.make_subscription = mock.Mock()
     z.call = mock.Mock()
     z.call.return_value = mock.Mock()
     z.subscribe(product_rate_plan_id=mock.Mock(),
                 monthly_term=mock.Mock(),
                 zAccount=None,
                 zContact=None,
                 process_payments_flag=True,
                 generate_invoice_flag=True,
                 generate_preview=False,
                 account_name=mock.Mock(),
                 subscription_name=mock.Mock(),
                 recurring=True,
                 payment_method=mock.Mock(),
                 order_id=mock.Mock(),
                 user=mock.Mock(),
                 billing_address=mock.Mock(),)
     assert z.make_account.call_count == 1
     assert z.make_rate_plan_data.call_count == 1
     assert z.make_subscription.call_count == 1
     assert z.call.call_count == 1
Ejemplo n.º 25
0
 def test_create_product_ammendment_create_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.create = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.create.return_value = [response]
     z.create_product_amendment(effective_date=mock.Mock(),
                             subscription_id=mock.Mock(),
                             name_prepend='something',
                             amendment_type=mock.Mock())
     assert z.create.call_count == 1
Ejemplo n.º 26
0
 def test_get_product_rate_plan_charge_pricing(self):
     z = Zuora(self.zuora_settings)
     product_rate_plan_id = 'df2423dffgf'
     z.get_camel_converted_product_rate_plan_charges = mock.Mock()
     z.get_camel_converted_product_rate_plan_charge_tiers = mock.Mock()
     z.get_camel_converted_product_rate_plan_charges.return_value = {
                                     product_rate_plan_id: {}}
     z.get_camel_converted_product_rate_plan_charge_tiers.return_value = {}
     z.get_product_rate_plan_charge_pricing(
                                 product_rate_plan_id=product_rate_plan_id)
     assert z.get_camel_converted_product_rate_plan_charges.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charge_tiers.call_count\
                                                                     == 1
Ejemplo n.º 27
0
 def test_get_subscriptions_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_subscriptions(account_id='df2423dffgf',
                         auto_renew='True',
                         status='Good?',
                         term_type='Evergreen',
                         term_end_date=mock.Mock(),
                         term_start_date=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 28
0
 def test_get_subscriptions_query_called(self):
     z = Zuora(self.zuora_settings)
     z.query = mock.Mock()
     response = mock.Mock()
     response.records = [1]
     z.query.return_value = response
     z.get_subscriptions(account_id='df2423dffgf',
                         auto_renew='True',
                         status='Good?',
                         term_type='Evergreen',
                         term_end_date=mock.Mock(),
                         term_start_date=mock.Mock())
     assert z.query.call_count == 1
Ejemplo n.º 29
0
 def test_add_product_ammendment_create_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.create = mock.Mock()
     z.create_product_amendment = mock.Mock()
     z.update_product_amendment = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.create.return_value = [response]
     z.add_product_amendment(name='test',
                             subscription_id=mock.Mock(),
                             product_rate_plan_id=mock.Mock())
     assert z.create_product_amendment.call_count == 1
     assert z.create.call_count == 1
Ejemplo n.º 30
0
 def test_cancel_subscription_update_called(self):
     z = Zuora(self.zuora_settings)
     z.create_product_amendment = mock.Mock()
     z.update_product_amendment = mock.Mock()
     z.cancel_subscription(subscription_id=mock.Mock())
     assert z.create_product_amendment.call_count == 1
     assert z.update_product_amendment.call_count == 1
Ejemplo n.º 31
0
 def test_match_product_rate_plans(self):
     z = Zuora(self.zuora_settings)
     z.get_camel_converted_products = mock.Mock()
     z.get_camel_converted_product_rate_plans = mock.Mock()
     z.get_camel_converted_product_rate_plan_charges = mock.Mock()
     z.get_camel_converted_product_rate_plan_charge_tiers = mock.Mock()
     z.get_camel_converted_products.return_value = {}
     z.get_camel_converted_product_rate_plans.return_value = {}
     z.get_camel_converted_product_rate_plan_charges.return_value = {}
     z.get_camel_converted_product_rate_plan_charge_tiers.return_value = {}
     z.match_product_rate_plans(shortcodes=['sub_bronze', 'sub_gold'])
     assert z.get_camel_converted_products.call_count == 1
     assert z.get_camel_converted_product_rate_plans.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charges.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charge_tiers.call_count\
                                                                     == 1
Ejemplo n.º 32
0
 def test_update_account_update_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.update_account(account_id=mock.Mock(), update_dict={})
     assert z.update.call_count == 1
Ejemplo n.º 33
0
 def test_create_active_account_get_payment_method_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.get_payment_method = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.create_active_account(zAccount=mock.Mock(), zContact=mock.Mock(),
                             payment_method_id=mock.Mock(),
                             user=None, billing_address=None)
     assert z.get_payment_method.call_count == 1
     assert z.update.call_count == 1
Ejemplo n.º 34
0
 def test_update_product_ammendment_update_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.update_product_amendment(effective_date=mock.Mock(),
                             zAmendment=mock.Mock())
     assert z.update.call_count == 1
Ejemplo n.º 35
0
 def test_add_product_ammendment_create_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.create = mock.Mock()
     z.create_product_amendment = mock.Mock()
     z.update_product_amendment = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.create.return_value = [response]
     z.add_product_amendment(name='test',
                             subscription_id=mock.Mock(),
                             product_rate_plan_id=mock.Mock())
     assert z.create_product_amendment.call_count == 1
     assert z.create.call_count == 1
Ejemplo n.º 36
0
 def test_create_product_ammendment_create_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.create = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.create.return_value = [response]
     z.create_product_amendment(effective_date=mock.Mock(),
                             subscription_id=mock.Mock(),
                             name_prepend='something',
                             amendment_type=mock.Mock())
     assert z.create.call_count == 1
Ejemplo n.º 37
0
 def test_match_product_rate_plans(self):
     z = Zuora(self.zuora_settings)
     z.get_camel_converted_products = mock.Mock()
     z.get_camel_converted_product_rate_plans = mock.Mock()
     z.get_camel_converted_product_rate_plan_charges = mock.Mock()
     z.get_camel_converted_product_rate_plan_charge_tiers = mock.Mock()
     z.get_camel_converted_products.return_value = {}
     z.get_camel_converted_product_rate_plans.return_value = {}
     z.get_camel_converted_product_rate_plan_charges.return_value = {}
     z.get_camel_converted_product_rate_plan_charge_tiers.return_value = {}
     z.match_product_rate_plans(shortcodes=['sub_bronze', 'sub_gold'])
     assert z.get_camel_converted_products.call_count == 1
     assert z.get_camel_converted_product_rate_plans.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charges.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charge_tiers.call_count\
                                                                     == 1
Ejemplo n.º 38
0
 def test_get_product_rate_plan_charge_pricing(self):
     z = Zuora(self.zuora_settings)
     product_rate_plan_id = 'df2423dffgf'
     z.get_camel_converted_product_rate_plan_charges = mock.Mock()
     z.get_camel_converted_product_rate_plan_charge_tiers = mock.Mock()
     z.get_camel_converted_product_rate_plan_charges.return_value = {
                                     product_rate_plan_id: {}}
     z.get_camel_converted_product_rate_plan_charge_tiers.return_value = {}
     z.get_product_rate_plan_charge_pricing(
                                 product_rate_plan_id=product_rate_plan_id)
     assert z.get_camel_converted_product_rate_plan_charges.call_count == 1
     assert z.get_camel_converted_product_rate_plan_charge_tiers.call_count\
                                                                     == 1
Ejemplo n.º 39
0
 def test_create_active_account_get_payment_method_called(self):
     z = Zuora(self.zuora_settings)
     z.client = mock.Mock()
     z.get_payment_method = mock.Mock()
     z.update = mock.Mock()
     response = mock.Mock()
     response.Success = True
     z.update.return_value = [response]
     z.create_active_account(zAccount=mock.Mock(), zContact=mock.Mock(),
                             payment_method_id=mock.Mock(),
                             user=None, billing_address=None)
     assert z.get_payment_method.call_count == 1
     assert z.update.call_count == 1
Ejemplo n.º 40
0
    def test_update_product_ammendment2_amend_called(self):
        quantity = 10
        now = datetime.datetime.now()

        z = Zuora(self.zuora_settings)
        z.client = mock.Mock()
        z.amend = mock.Mock()
        response = mock.Mock()
        response.Success = True

        z.amend.return_value = [response]
        z.update_product_amendment2(
            name=now.strftime('AMEND-%Y-%m'),
            description='Changing quantity to %s items' % (quantity),
            quantity=quantity,
            contract_effective_datetime=now,
            effective_datetime=now,
            service_activation_datetime=now,
            customer_acceptance_datetime=now,
            subscription_id=mock.Mock(),
            rate_plan_id=mock.Mock(),
            product_rate_plan_charge_id=mock.Mock())
        assert z.amend.call_count == 1