summaryrefslogtreecommitdiff
path: root/include/ut/http_utility_test.cpp
blob: c92bf1e4e54cdd02a9183279937197748740a09f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "http_utility.hpp"

#include <gtest/gtest.h>

namespace http_helpers
{
namespace
{

TEST(RequestPrefersHtml, ContainsHtmlReturnsTrue)
{
    EXPECT_TRUE(requestPrefersHtml("text/html, application/json"));
}

TEST(RequestPrefersHtml, NoHtmlReturnsFalse)
{
    EXPECT_FALSE(requestPrefersHtml("*/*, application/octet-stream"));
    EXPECT_FALSE(requestPrefersHtml("application/json"));
}

TEST(IsOctetAccepted, ContainsOctetReturnsTrue)
{
    EXPECT_TRUE(isOctetAccepted("*/*, application/octet-stream"));
}

TEST(IsOctetAccepted, NoOctetReturnsFalse)
{
    EXPECT_FALSE(isOctetAccepted("text/html, application/json"));
    EXPECT_FALSE(isOctetAccepted("application/json"));
}

} // namespace
} // namespace http_helpers