2021-11-22 21:14:04 +00:00
|
|
|
using System;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http.Headers;
|
2014-09-02 04:02:55 +00:00
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2016-04-04 17:40:51 +00:00
|
|
|
public class IndexHtmlFixture : IntegrationTest
|
2014-09-02 04:02:55 +00:00
|
|
|
{
|
2021-11-22 21:14:04 +00:00
|
|
|
private HttpClient _httpClient = new HttpClient();
|
|
|
|
|
2014-09-02 04:02:55 +00:00
|
|
|
[Test]
|
|
|
|
public void should_get_index_html()
|
|
|
|
{
|
2021-11-22 21:14:04 +00:00
|
|
|
var request = new HttpRequestMessage(HttpMethod.Get, RootUrl);
|
|
|
|
var response = _httpClient.Send(request);
|
|
|
|
var text = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
2014-09-02 04:02:55 +00:00
|
|
|
text.Should().NotBeNullOrWhiteSpace();
|
|
|
|
}
|
2021-10-21 20:04:26 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void index_should_not_be_cached()
|
|
|
|
{
|
2021-11-22 21:14:04 +00:00
|
|
|
var request = new HttpRequestMessage(HttpMethod.Get, RootUrl);
|
|
|
|
var response = _httpClient.Send(request);
|
|
|
|
|
|
|
|
var headers = response.Headers;
|
2021-10-21 20:04:26 +00:00
|
|
|
|
2021-11-22 21:14:04 +00:00
|
|
|
headers.CacheControl.NoStore.Should().BeTrue();
|
|
|
|
headers.CacheControl.NoCache.Should().BeTrue();
|
|
|
|
headers.Pragma.Should().Contain(new NameValueHeaderValue("no-cache"));
|
2021-10-21 20:04:26 +00:00
|
|
|
|
2021-11-22 21:14:04 +00:00
|
|
|
response.Content.Headers.Expires.Should().BeBefore(DateTime.UtcNow);
|
2021-10-21 20:04:26 +00:00
|
|
|
}
|
2014-09-02 04:02:55 +00:00
|
|
|
}
|
2019-12-22 21:24:10 +00:00
|
|
|
}
|