def test_user_fails_to_subscribe_no_card(self, _sf, _ss, _sfa, session):
        """ User couldn't subscribe because they didn't setup a
            card or stripe account"""
        user = UnstripedUserFactory()
        plan = Plan.paid()
        uss = UserStripe(user)
        session.add(user)
        session.flush()

        with pytest.raises(AssertionError):
            uss.link_to_plan(plan)
    def test_delete_customer(self, app):
        """ Delete a Stripe Customer """

        user = StripedUserFactory(tier="paid",
                                  email="*****@*****.**",
                                  stripe__payment_method="pm_card_visa")
        uss = UserStripe(user)
        uss.link_to_plan(Plan.paid())

        customer_id = user.stripe_id

        UserStripe(user).delete_stripe_customer()

        cus = stripe.Customer.retrieve(customer_id)
        assert cus.deleted is True
        assert user.plan == Plan.free()