首页
\
问答
\
我可以在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
最满意答案
相关问答
更多-
通过HTML5输入音频?(Audio input via HTML5?)[2022-02-02]
网络摄像头和麦克风支持不是HTML 5规范的特色 新的API 除了指定标记之外,HTML5还指定脚本应用程序编程接口(API)。 现有的文档对象模型(DOM)接口被扩展并记录了事实上的功能。 还有新的API,例如: 立即模式的画布元素 2D绘图定时媒体播放 离线存储数据库(离线网站 应用程序)文件编辑 拖放交叉文档 消息(web消息)浏览器 历史管理MIME类型和 协议处理器注册。 微观数据 一些新功能是HTML5的一部分,主要是因为没有志愿者将HTML5拆分并保留这些功能的单独规范。 Webcam and ... -
从Node.js服务器将音频流传输到HTML5 [2022-03-08]
这是HTML5音频和Icecast流当前状态的一个(稍微过时的)摘要 。 如您所见,MP3源似乎只适用于Safari(也可能是IE9)。 您可能需要对OGG Vorbis进行一些服务器端转码(使用ffmpeg或mencoder )。 我确信,当我发送Vorbis数据时,我能够使Chrome的行为正常。 Firefox仍然是一个笨蛋,也许它不喜欢分块编码(所有SHOUTcast服务器都使用HTTP/1.0版本响应进行响应,该响应尚未定义Transfer-Encoding: chunked )。 尝试使用OGG ... -
使用jS或html5以编程方式记录来自网页的音频输出?(Programatically record audio output from web page using jS or html5?)[2022-03-14]
您可以使用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是否有类似收音机的音频流解决方案?(Is there a good radio-like audio streaming solution for node.js?)[2021-11-11]
是的,这完全有可能。 我目前正在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 ...
-
在完成之前重新启动HTML5音频元素(JS:setTimeout)(Restart HTML5 audio element before it completes (JS: setTimeout))[2021-09-12]
您必须在播放音频之前将音频的当前时间设置为开头。 这个功能应该有效。 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 ... -
HTML5音频参考(HTML5 audio reference)[2024-01-07]
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