首页 \ 问答 \ 我可以在Django测试中避免permission_required装饰器吗?(Can I avoid permission_required decorator on Django testing?)

我可以在Django测试中避免permission_required装饰器吗?(Can I avoid permission_required decorator on Django testing?)

我正在测试一系列广泛使用'permission_required'装饰器的Django应用程序。 这在我拥有的大多数视图中以302 HTTP响应派生。

我的问题是:在测试中有什么方法可以避免或取消激活'permission_required',所以当我打电话给我的意见时,我可以得到200响应,而不是302?

谢谢!


I am testing a set of Django applications which make extensive use of the 'permission_required' decorator. This derives in a 302 HTTP response in most of the views that I have.

My question is: there is any way to avoid or deactivate the 'permission_required' in testing, so I can get a 200 response when I call my views, instead of the 302?

Thank you!


原文:https://stackoverflow.com/questions/6772676
更新时间:2022-09-21 10:09

最满意答案

看起来最好的工作是jPlayer的用例之一; 如果问题突然出现或者更好的事情发生了变化,它将会更新。


Looks like the best thing for the job is one of the use-cases of jPlayer; will update if problems crop up or something better rears its head.

相关问答

更多
  • 网络摄像头和麦克风支持不是HTML 5规范的特色 新的API 除了指定标记之外,HTML5还指定脚本应用程序编程接口(API)。 现有的文档对象模型(DOM)接口被扩展并记录了事实上的功能。 还有新的API,例如: 立即模式的画布元素 2D绘图定时媒体播放 离线存储数据库(离线网站 应用程序)文件编辑 拖放交叉文档 消息(web消息)浏览器 历史管理MIME类型和 协议处理器注册。 微观数据 一些新功能是HTML5的一部分,主要是因为没有志愿者将HTML5拆分并保留这些功能的单独规范。 Webcam and ...
  • 这是HTML5音频和Icecast流当前状态的一个(稍微过时的)摘要 。 如您所见,MP3源似乎只适用于Safari(也可能是IE9)。 您可能需要对OGG Vorbis进行一些服务器端转码(使用ffmpeg或mencoder )。 我确信,当我发送Vorbis数据时,我能够使Chrome的行为正常。 Firefox仍然是一个笨蛋,也许它不喜欢分块编码(所有SHOUTcast服务器都使用HTTP/1.0版本响应进行响应,该响应尚未定义Transfer-Encoding: chunked )。 尝试使用OGG ...
  • 您可以使用Web Audio API来记录任何Web Audio节点的输出,而不仅仅是麦克风输入。 如果您想要录制音频的网页使用Web Audio API来生成声音,那么您绝对可以使用Web Audio API来录制它(请查看Recorder.js)。 如果声音是从html元素播放的,则可以将其转换为Web Audio节点并记录下来。 看看这个: http : //updates.html5rocks.com/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFF ...
  • 花了一些时间在Buzz源代码后,我目前没有看到任何方法。 幸运的是,原始音频元素被暴露,允许这样的事情: buzz.sound.prototype.destroy = function () { this.set('src', ''); } 这可能会为Buzz弄乱一些内部状态信息。 我现在正在调查。 After spending some time with the Buzz source, I don't see any method for doing this currently. Fort ...
  • 看起来最好的工作是jPlayer的用例之一; 如果问题突然出现或者更好的事情发生了变化,它将会更新。 Looks like the best thing for the job is one of the use-cases of jPlayer; will update if problems crop up or something better rears its head.
  • 我自己得到了答案。 经过双重,三重,四重检查后,我发现该网站由GoDaddy托管,我知道它并不是您能期望的最佳品质。 (实际上它们在很多方面都很糟糕。如果你能避免它,就不要跟GoDaddy一起去。只是我的个人观点。)我们改变了托管,问题就消失了。 糟糕的是,我花了几天的时间无所事事。 I got the answer myself to this one. After double-, triple-, quadruple-checking everything it hit me, the site wa ...
  • 是的,这完全有可能。 我目前正在Node.js上主持互联网广播。 您所要做的就是从编码器获取原始流数据并通过HTTP将其发送到任何连接的客户端。 客户端非常适合与流同步,因此您不必担心与帧或任何内容对齐。 Yes, this is entirely possible. I am hosting internet radio on Node.js at the moment. All you have to do is take the raw stream data from the encoder and ...
  • 不会喜欢这个答案,但Chromecast根本不支持自签名证书。 它构建在Chromium安全模型中。 如果您可以将证书装载到证书商店中,它就可以工作(Android和Fire平板电脑和电视可以做到这一点),但这可能会有所帮助,但Chromecast(和FireStick)无法做到这一点。 Not gonna like this answer, but Chromecast simply won't support self-signed certs. It is built into the Chromiu ...
  • 您必须在播放音频之前将音频的当前时间设置为开头。 这个功能应该有效。 function playTone(){ var tone = document.getElementById('tone'); tone.currentTime = 0; tone.play(); } You have to set the current time of the audio to the beginning before you play the audio. This function sh ...
  • play(),pause()等来自HTMLMediaElement接口,这里记录: http : //www.w3.org/TR/html5/video.html#htmlmediaelement play(), pause() etc come from HTMLMediaElement interface, documented here: http://www.w3.org/TR/html5/video.html#htmlmediaelement

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)