Fixed cookie tests with expired dates.

This commit is contained in:
Taloth Saldono 2016-07-22 00:34:18 +02:00
parent 8966e5a403
commit c4a3bc3d2f
1 changed files with 3 additions and 4 deletions

View File

@ -336,8 +336,8 @@ namespace NzbDrone.Common.Test.Http
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(culture); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(culture);
try try
{ {
// the date is bad in the below - should be 13-Jul-2016 // the date is bad in the below - should be 13-Jul-2026
string malformedCookie = @"__cfduid=d29e686a9d65800021c66faca0a29b4261436890790; expires=Wed, 13-Jul-16 16:19:50 GMT; path=/; HttpOnly"; string malformedCookie = @"__cfduid=d29e686a9d65800021c66faca0a29b4261436890790; expires=Mon, 13-Jul-26 16:19:50 GMT; path=/; HttpOnly";
var requestSet = new HttpRequestBuilder(string.Format("http://{0}/response-headers", _httpBinHost)) var requestSet = new HttpRequestBuilder(string.Format("http://{0}/response-headers", _httpBinHost))
.AddQueryParam("Set-Cookie", malformedCookie) .AddQueryParam("Set-Cookie", malformedCookie)
.Build(); .Build();
@ -366,12 +366,11 @@ namespace NzbDrone.Common.Test.Http
} }
} }
[TestCase("lang_code=en; expires=Fri, 23-Dec-2016 18:09:14 GMT; Max-Age=31536000; path=/; domain=.abc.com")] [TestCase("lang_code=en; expires=Wed, 23-Dec-2026 18:09:14 GMT; Max-Age=31536000; path=/; domain=.abc.com")]
public void should_reject_malformed_domain_cookie(string malformedCookie) public void should_reject_malformed_domain_cookie(string malformedCookie)
{ {
try try
{ {
// the date is bad in the below - should be 13-Jul-2016
string url = string.Format("http://{0}/response-headers?Set-Cookie={1}", _httpBinHost, Uri.EscapeUriString(malformedCookie)); string url = string.Format("http://{0}/response-headers?Set-Cookie={1}", _httpBinHost, Uri.EscapeUriString(malformedCookie));
var requestSet = new HttpRequest(url); var requestSet = new HttpRequest(url);