doujiao1948 2014-09-16 23:47
浏览 23
已采纳

Behat:如何测试密码重置表单?

I've just started to build an API & Some web app features, using Behat to test scenarios in a BDD fashion.

All is going well, I'm testing the API with a Rest Context and Web App bits with Mink.

However, I've reached a bit of a stumbling block in the automated tests...

I've created an API endpoint for a "Forgot Password" feature, which does the usual random hash/token effort, then emails a link to /reset-password/token

However, in order to automate testing of this URL using Mink I'd need to know the hash of the test user (created earlier in the test suite). Because it's random and will change every time a user requests a password reset, I'm a little stumped as to how I can test this!

  • 写回答

1条回答 默认 最新

  • duancuisan2503 2014-09-17 10:06
    关注

    Simple: don't be shy to lookup the last (or based on any other criteria) row in your password reset tokens table to get the last generated hash.

    If you are new to subject it might sound a little strange that with Behat / Mink you need to do things like that, but thats a totally normal practice to have shortcuts or workarounds like that.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?