使用 rspec 测试omniauth 哈希格式
我正在尝试为 Omniauth 集成编写一些测试。具体来说,我想知道如果升级,哈希格式是否随版本而变化。
我找到了 wiki(https://github.com/intridea/omniauth/wiki/Integration-Testing),它表明我可以手动模拟身份验证:
OmniAuth.config.mock_auth[:twitter] = {
'provider' => 'twitter',
'uid' => '123545'
# etc.
}
...但我认为这没有帮助。我必须手动将哈希值配置为我期望 Omniauth 的哈希值返回的值。这并不能告诉我 Omniauth 实际上返回的哈希值是否符合该格式。
我在这里遗漏了一些明显的东西吗?如何测试我期望的格式是否实际上是 Omniauth 计划提供给我的格式?
I'm trying to write some tests for Omniauth integration. Specifically, I want to know if the format of the hash has changed from version to version if I upgrade.
I found the wiki (https://github.com/intridea/omniauth/wiki/Integration-Testing) which shows that I can mockup an auth manually:
OmniAuth.config.mock_auth[:twitter] = {
'provider' => 'twitter',
'uid' => '123545'
# etc.
}
...but I don't see this as helpful. I have to manually configure the hash to what I expect Omniauth's hash to return. This doesn't tell me if the hash that Omniauth is actually to return fits that format.
Am I missing something obvious here? How can I test if the format I'm expecting is actually what Omniauth plans to give me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论