使用 Cucumber 和 webrat 测试 authlogic-open-id 的最佳方法是什么?

发布于 2024-08-02 11:11:51 字数 739 浏览 1 评论 0原文

我在使用 cucumber 和 webrat 在 Rails 应用程序中测试 authlogic-openid 身份验证时遇到问题。遵循 Ryan Bates 的优秀截屏视频,我能够使用 open-id 安装 authlogic插件。当我使用浏览器登录时,OpenID 可以工作,但到目前为止我无法使用 cucumber 和 webrat 测试该应用程序。

我尝试使用 rots 作为虚拟开放 ID 服务器。当我在浏览器中尝试时,这再次有效,但 webrat 不会正确遵循与虚拟​​开放 ID 服务器进行身份验证所需的 get/post 重定向。

这个答案建议覆盖身份验证方法以始终返回成功登录,但这种方法似乎不像对应用程序进行集成测试。

功能测试 authlogic-open-id 的最佳方法是什么?我还应该打扰吗?我是否应该在用户已登录时测试操作并假设 OpenID 可以工作?

I've been having trouble using cucumber and webrat to test authlogic-openid authentication in a rails app. Following Ryan Bates's excellent screencast I was able to install authlogic with the open-id plugin. OpenID works when I login using the browser but so far I've been unable to test the app using cucumber and webrat.

I've tried using rots as a dummy open id server. Again this works when I try it in the browser but webrat won't doesn't correctly follow the get/post redirects required to authentic with the dummy open id server.

This answer on SO suggests overriding the authentication method to always return a successful login but this approach doesn't seem like integration testing the application.

What is the best way to functionally test authlogic-open-id? Should I even bother? Should I test the actions when the user is already logged in and assume OpenID will work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2024-08-09 11:11:51

您是否尝试过测试助手set_session_for(@user)?我假设该插件已经过测试,并且确实不需要再次测试它(除非您修改了它)。

have you tried the test helper set_session_for(@user)? I would assume that the plugin is tested and there really is no need to test it again (unless you have modified it).

仅冇旳回忆 2024-08-09 11:11:51

我在 authlogic 邮件列表上问了同样的问题。我得到了一个很好的答案,指导我使用 WWW:Mechanise 和一些补丁代码,使 webrat 遵循所有重定向。这似乎适用于使用 authlogic open id 和本地 open id 服务器进行 Rails 集成测试。

这是讨论帖

I asked the same question on the authlogic mailing list. I got a good answer directing me to use WWW:Mechanise with some patch code to that makes webrat follow all redirects. This seems to work for doing rails integration testing using authlogic open id with a local open id server.

Here's the discussion thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文