stripe-payments - 在 Stripe CLI 中使用 fixtures

我想通过使用 Stripe CLI 触发一些特定请求来测试我的 API 行为.

例如:

strip 触发器 customer.subscription.deleted # 这里有一些固定装置

有一个 fixtures 命令记录为一个功能,但我不知道如何使用它。文档说:

The fixtures command lets you run a json file as a series of API requests. This can be useful for things like filling data, executing specific flows, or testing API behavior.

https://github.com/stripe/stripe-cli/wiki/fixtures-command

如何将夹具加载到 CLI 中?

最佳答案

第一步是创建一个包含灯具的 JSON 文件。您链接到的文档提供了一个这样的示例,但如果您:

  • 找到最接近你想做的事情的可用触发器
  • 找到相应的夹具文件in the repo
  • 根据您的需要修改它

然后您可以使用 stripe fixtures name_of_your_fixture_file.json 执行夹具

您可以在 trigger documentation 中查找可用的触发器.请记住,固定装置只会发出一系列 API 请求,fixtures 数组中的每个对象代表一个 API 调用,因此您可以执行 API docs 中指定的任何操作。 .

https://stackoverflow.com/questions/59745126/

相关文章:

c - 我如何在进行分区作业时转换?

c# - 如何在 ServiceStack 中返回不同的 Http Status Code

python - 为什么 randn 并不总是均值为 0 且方差为 1?

python - 从 BigQuery 获取数据需要很长时间

django - 错误模块 'tablib.formats._xls' 没有属性 'title'

angular - 将 Angular 4 升级到 Angular 8

ruby-on-rails - 如何在转换后的字符串不充满反斜杠的情况下将哈希转换为 JSON

xcode - SwiftUI:如何创建自定义 UIDatePicker?

php - 如何在php中将一个元素添加到子数组中

swiftui - 如何修复无法在 Swift 中找到文件 json