Sonarr/src/NzbDrone.Integration.Test/IndexHtmlFixture.cs

39 lines
1.2 KiB
C#
Raw Normal View History

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]
public class IndexHtmlFixture : IntegrationTest
2014-09-02 04:02:55 +00:00
{
private HttpClient _httpClient = new HttpClient();
2014-09-02 04:02:55 +00:00
[Test]
public void should_get_index_html()
{
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();
}
[Test]
public void index_should_not_be_cached()
{
var request = new HttpRequestMessage(HttpMethod.Get, RootUrl);
var response = _httpClient.Send(request);
var headers = response.Headers;
headers.CacheControl.NoStore.Should().BeTrue();
headers.CacheControl.NoCache.Should().BeTrue();
headers.Pragma.Should().Contain(new NameValueHeaderValue("no-cache"));
response.Content.Headers.Expires.Should().BeBefore(DateTime.UtcNow);
}
2014-09-02 04:02:55 +00:00
}
}