On 01/30/2016 09:31 PM, Kushagra Singh wrote:
Hi, I'm a bit stuck while writing tests. How do I test the fact that a secure only cookie does not get saved over an insecure connection? Even if the cookie gets saved, it will not be transmitted over an insecure connection (cookie_matches_url() ensures that). So even though I can see in the log that the cookie is not saved, I can't figure out how exactly to test that in the test suite, since I cannot check using RejectHeader. Please find attached the test I have written.
I've tried passing '--save-cookies=mycookies.wget', which creates a new file in the test's directory, and then adding that file to the 'ExpectedDownloadedFiles' list, for Wget to check if it's there. The problem is the content check always fails, because Wget introduces comments at the top of the cookie file that include the time and date, and thus the test always fails saying that the contents don't match. I guess the solution here would be to create a hook and test that a cookie file has been created, which has nothing but the initial comments. I don't know if that would be possible. @Darshit?
And one thing I noticed, Test-Proto.py tries to import HTTP and HTTPS classes from " misc.constants", which is wrong. It should be imported from test.base_test right? Regards, Kushagra
Regards, - AJ
