def test_http_post_set_name(self):
     action = HttpPOST("Send", URL)
     action.set_name("Praesent")
     self.assertDictEqual(action.as_data(), {
         "@type": "HttpPOST",
         "name": "Praesent",
         "target": URL
     })
 def test_http_post_add_headers(self):
     action = HttpPOST("Send", URL)
     action.add_headers([
         Header("Transfer-Encoding", "chunked"),
         Header("Proxy-Authenticate", "Basic")
     ])
     self.assertDictEqual(
         action.as_data(), {
             "@type":
             "HttpPOST",
             "name":
             "Send",
             "target":
             URL,
             "headers": [
                 {
                     "name": "Transfer-Encoding",
                     "value": "chunked"
                 },
                 {
                     "name": "Proxy-Authenticate",
                     "value": "Basic"
                 },
             ]
         })
     action.add_headers(Header("Trailer", "Expires"))
     self.assertDictEqual(
         action.as_data(), {
             "@type":
             "HttpPOST",
             "name":
             "Send",
             "target":
             URL,
             "headers": [{
                 "name": "Transfer-Encoding",
                 "value": "chunked"
             }, {
                 "name": "Proxy-Authenticate",
                 "value": "Basic"
             }, {
                 "name": "Trailer",
                 "value": "Expires"
             }]
         })
 def test_http_post_set_target(self):
     action = HttpPOST("Send", URL)
     action.set_target("https://www.sample.domain.com")
     self.assertDictEqual(
         action.as_data(), {
             "@type": "HttpPOST",
             "name": "Send",
             "target": "https://www.sample.domain.com"
         })
 def test_http_post_set_body_content_type(self):
     action = HttpPOST("Post", URL)
     action.set_body_content_type("content_type")
     self.assertDictEqual(
         action.as_data(), {
             "@type": "HttpPOST",
             "name": "Post",
             "target": URL,
             "bodyContentType": "content_type"
         })
 def test_http_post_set_body(self):
     action = HttpPOST("Post", URL)
     action.set_body("sample body")
     self.assertDictEqual(
         action.as_data(), {
             "@type": "HttpPOST",
             "name": "Post",
             "target": URL,
             "body": "sample body"
         })
 def test_http_post(self):
     action = HttpPOST("Send",
                       URL,
                       headers=[
                           Header("Content-Length", "42"),
                       ],
                       body="qwerty",
                       body_content_type="content_type")
     self.assertDictEqual(
         action.as_data(), {
             "@type": "HttpPOST",
             "name": "Send",
             "target": URL,
             "headers": [{
                 "name": "Content-Length",
                 "value": "42"
             }],
             "body": "qwerty",
             "bodyContentType": "content_type"
         })