'Valid subscription form'

def test_add_subscription(self):

    subscription_list = {'object': 'list', 'data': [], 'has_more': False, 'total_count': 1, 'url': '/v1/customers/cus_12345/subscriptions'}
    customer_obj = {'id': 'cus_12345', 'description': self.user.get_full_name(), 'email': self.user.email, 'subscriptions': subscription_list}
    subscription_obj = {'id': 'sub_12345', 'object': 'subscription', 'customer': 'cus_12345', 'plan': {'id': 'v1-org-5', 'object': 'plan', 'amount': 1000, 'currency': 'usd', 'name': 'Test'}}
    self.mock_request([(customer_obj, ''), (subscription_list, ''), (subscription_obj, '')])
    subscription_form = GoldSubscriptionForm({'level': 'v1-org-5', 'last_4_digits': '0000', 'stripe_token': 'GARYBUSEY'}, customer=self.user)
    self.assertTrue(subscription_form.is_valid())
    subscription = subscription_form.save()
    self.assertEqual(subscription.level, 'v1-org-5')
    self.assertEqual(subscription.stripe_id, 'cus_12345')
    self.assertIsNotNone(self.user.gold)
    self.assertEqual(self.user.gold.first().level, 'v1-org-5')
    self.mocks['request'].request.assert_has_calls([mock.call('post', '/v1/customers', {'description': mock.ANY, 'email': mock.ANY}, mock.ANY), mock.call('get', '/v1/customers/cus_12345/subscriptions', mock.ANY, mock.ANY), mock.call('post', '/v1/customers/cus_12345/subscriptions', {'source': mock.ANY, 'plan': 'v1-org-5'}, mock.ANY)])
