webtester 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae26b6e2eb7322d6a5b966a77bb0567a7dadecdf
4
- data.tar.gz: 1ded93b0d0cdc80b35d4fc3118d55a943d5df35c
3
+ metadata.gz: 324876a5e91c34470e62213bd59e91cf302c778d
4
+ data.tar.gz: 755c266e7e89a3a0afd385d5faced240c7d70129
5
5
  SHA512:
6
- metadata.gz: cb7b8584e4433c484c73f6a8031f2a8cb58c367d53901c365d9e526511722b099ea2924e9f7931d3c563c6d59a68bdc8746c2cd4f641429e6d28adef8c6b6387
7
- data.tar.gz: 243ec30339b7b3f68866a10b7f08845747d6fe4c1cc7446d7dbb28ffc6785d2da798abbf2c0a7a3fb450e8424c952213ac89a323ac64460a1941a15fe1447a0a
6
+ metadata.gz: d7833ff68aa8f6dc4560b12ecbdbf6dfb346ee5750571ebee3fe23f9acfd7ef36bf62890628a8b975d1e328fd6aab80d4e84c16f3e5e337138a700c7b2ab6e0c
7
+ data.tar.gz: b72ce344ae3fa1b29035fef936a0f5a3d15acab090fc9f362b8571bfd2948e8a7a53f31f7103c90c7c81495ece69dbe68326a0395385ad343559c75cca726365
data/lib/request.rb CHANGED
@@ -16,12 +16,12 @@ module WT
16
16
  attr_accessor :proxy_port
17
17
 
18
18
  def initialize(request_type, request_url, request_data = {})
19
- @request_type = request_type
20
- @request_url = request_url
21
- @request_data = request_data
22
- @headers = {}
23
- @proxy_host = nil
24
- @proxy_port = 0
19
+ self.request_type = request_type
20
+ self.request_url = request_url
21
+ self.request_data = request_data
22
+ self.headers = {}
23
+ self.proxy_host = nil
24
+ self.proxy_port = 0
25
25
  end
26
26
 
27
27
  def exec
@@ -85,9 +85,9 @@ module WT
85
85
 
86
86
  http = nil
87
87
 
88
- if @proxy_host
89
- WT::Log.debug("\t* @proxy_host = #{@proxy_host}")
90
- http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(host_ip, port)
88
+ if self.proxy_host
89
+ WT::Log.debug("\t* @proxy_host = #{self.proxy_host}, proxy_port = #{self.proxy_port}")
90
+ http = Net::HTTP.new(self.proxy_host, self.proxy_port)
91
91
  else
92
92
  WT::Log.debug("\t* Net::HTTP.new(#{host_ip}, #{port})")
93
93
  http = Net::HTTP.new(host_ip, port)
data/lib/test.rb CHANGED
@@ -72,10 +72,14 @@ module WT
72
72
  def self.request_from_yaml(yaml_request)
73
73
  type = yaml_request['type']
74
74
  url = yaml_request['url']
75
- body = {}
76
- body = yaml_request['body'] if yaml_request['body']
75
+ body = yaml_request['body'] || {}
76
+
77
+ proxy_parts = yaml_request['proxy'].split(':') if yaml_request['proxy']
77
78
 
78
79
  request = WT::Request.new(type, url, body)
80
+ request.proxy_host = proxy_parts[0]
81
+ request.proxy_port = proxy_parts[1]
82
+ request
79
83
  end
80
84
 
81
85
  def self.assertion_from_yaml(yaml_response)
data/lib/web_session.rb CHANGED
@@ -29,8 +29,8 @@ module WT
29
29
  end
30
30
 
31
31
  # set proxy if exists
32
- req.proxy_host = @proxy_host
33
- req.proxy_port = @proxy_port
32
+ req.proxy_host = @proxy_host if @proxy_host
33
+ req.proxy_port = @proxy_port if @proxy_port > 0
34
34
 
35
35
  result = req.exec
36
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webtester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego F. Nascimento