File: http_request_tests.cpp

package info (click to toggle)
pion 5.0.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,852 kB
  • ctags: 17,413
  • sloc: cpp: 13,965; sh: 10,263; perl: 269; makefile: 207; pascal: 152
file content (49 lines) | stat: -rw-r--r-- 1,446 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------------------------------------------------------------
// pion:  a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2012 Cloudmeter, Inc.  (http://www.cloudmeter.com)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//

#include <pion/config.hpp>
#include <pion/http/request.hpp>
#include <boost/test/unit_test.hpp>

using namespace pion;

class NewHTTPRequest_F : public http::request {
public:
    NewHTTPRequest_F() {
    }
    ~NewHTTPRequest_F() {
    }
};

BOOST_FIXTURE_TEST_SUITE(NewHTTPRequest_S, NewHTTPRequest_F)

BOOST_AUTO_TEST_CASE(checkSetMethodWithValidMethodDoesntThrow) {
    BOOST_CHECK_NO_THROW(set_method("GET"));
}

// Is this what we want?
BOOST_AUTO_TEST_CASE(checkSetMethodWithInvalidMethodDoesntThrow) {
    BOOST_CHECK_NO_THROW(set_method("NOT_A_VALID_METHOD"));
}

BOOST_AUTO_TEST_CASE(checkGetMethodReturnsGET) {
    BOOST_CHECK_EQUAL(get_method(), "GET");
}

BOOST_AUTO_TEST_CASE(checkGetMethodReturnsWhatSetMethodAssigns) {
    BOOST_CHECK_NO_THROW(set_method("POST"));
    BOOST_CHECK_EQUAL(get_method(), "POST");
}

BOOST_AUTO_TEST_CASE(checkGetMethodReturnsWhateverSetMethodAssigns) {
    BOOST_CHECK_NO_THROW(set_method("BLAH_BLAH_BLAH"));
    BOOST_CHECK_EQUAL(get_method(), "BLAH_BLAH_BLAH");
}

BOOST_AUTO_TEST_SUITE_END()