itriagetestrail 1.0.17 → 1.0.22

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: cc47a201c4d04fa3b717cecf4d23c7df4a1ee355
4
- data.tar.gz: d29e9dde8c13e406fc83dadcd045572a54dfdc2b
3
+ metadata.gz: bbe880b8fbaf52b1bd6279bcaad84c1e592e9bb6
4
+ data.tar.gz: 1d6afdcbcd973c6166308fa56f437bf36bcd6de9
5
5
  SHA512:
6
- metadata.gz: 73a9c8da9a0feb95009201bd95a2f7ffdc3ca4c0d72e0c09b2e3823830cd23171c64fc47a966c0d0a7e09d5ea66800b3a26b063d9da0e43bedf8f2d2d42307d3
7
- data.tar.gz: 94a357f9f699fa699fb7f5e8c2e884ba9b84bc30486f4dbedc8d9e4996207c30eca0d5265a2ed9fbbd51da7b1db64edaf4545e74d7319a7f020d2ed1746dd9f8
6
+ metadata.gz: 20202a2bc2cb09f045119e2fa7469eb815f8f0dface67bda8b0310cfcf8da6c9130d1d6db334c30a2bf95e498908642a8d6713e98dd7506ca2378cc79368c243
7
+ data.tar.gz: c48e7d371a314ca9ed0ff8ed4bbff98eedabe7e8fdcb14dc9413c150cf68faca1cc73f8b6b029217a07806a35cf10e955910faca1503e6010bd317ee1d968b9c
@@ -45,11 +45,24 @@ module Itriagetestrail
45
45
  end
46
46
  end
47
47
 
48
+ def testrail_online
49
+ # This is the very first call to TestRail
50
+ make_connection
51
+ @client.send_get('get_projects')
52
+
53
+ if @client.response_code == '200'
54
+ true
55
+ else
56
+ puts "**** TESTRAIL IS OFFLINE for maintenance or other reason with status code #{@client.response_code}"
57
+ false
58
+ end
59
+ end
60
+
48
61
  def _execute
49
62
  @execute = if @testrail_config[:user].nil? || @testrail_config[:user].empty?
50
63
  false
51
64
  else
52
- true
65
+ testrail_online
53
66
  end
54
67
  end
55
68
 
@@ -158,14 +171,14 @@ module Itriagetestrail
158
171
 
159
172
  #Supports tagging
160
173
  @testrail_case_fields = @client.send_get('get_case_fields')
161
-
162
- # TODO: Look into configuration_ids to add a plan
163
- add_testrail_run if @run_id.to_i.zero?
164
-
165
174
  @pool = Pool.new(1)
166
-
167
175
  @setup = true
168
176
  end
177
+
178
+ def create_run_id
179
+ # TODO: Look into configuration_ids to add a plan
180
+ add_testrail_run if @run_id.to_i.zero?
181
+ end
169
182
 
170
183
  def initialize_variables
171
184
  make_connection
@@ -21,9 +21,11 @@ module TestRail
21
21
  @url = ''
22
22
  @user = ''
23
23
  @password = ''
24
+ @response_code = nil
24
25
 
25
26
  attr_accessor :user
26
27
  attr_accessor :password
28
+ attr_reader :response_code
27
29
 
28
30
  def initialize(base_url)
29
31
  valid_regex = %r{/\/$/}
@@ -109,10 +111,10 @@ module TestRail
109
111
  retry_count = 0
110
112
  while retry_count < 10
111
113
  response = conn.request(request)
112
- response_code = response.code
113
- if response_code == '429'
114
+ @response_code = response.code
115
+ if @response_code == '429'
114
116
  sleep(response.header['retry-after'].to_i)
115
- elsif response.code == '500'
117
+ elsif @response_code == '500'
116
118
  puts response.to_s
117
119
  # this might require different handling for 500 'Deadlock found when
118
120
  # trying to get lock; try restarting transaction'
@@ -51,7 +51,6 @@ module Itriagetestrail
51
51
  # Pull Tag IDs
52
52
  unless @scenario_tags.nil?
53
53
 
54
- # TODO: Determine how to approach updating tags without permanently storing results on broken tests?
55
54
  # https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/runtime.rb
56
55
  # Test has to actually run in order to populate testrail.
57
56
 
@@ -67,12 +66,13 @@ module Itriagetestrail
67
66
  end
68
67
  end
69
68
 
70
- # TODO: Determine if there is a change, if so then we send a post
71
- testrail_case_tag_ids = @test_cases.select { |item| item['id'] == case_id }[0]['custom_tags']
69
+ current_case = @test_cases.select { |item| item['id'] == case_id }[0]
72
70
 
73
- unless testrail_case_tag_ids == scenario_tag_ids
74
- # Now that we have the case id, lets update tags
75
- @client.send_post("update_case/#{case_id}", { 'custom_tags': scenario_tag_ids})
71
+ testrail_case_tag_ids = current_case['custom_tags']
72
+ testrail_case_steps = current_case['custom_steps']
73
+
74
+ if testrail_case_tag_ids == scenario_tag_ids || testrail_case_steps == @scenario_steps
75
+ @client.send_post("update_case/#{case_id}", { 'custom_tags': scenario_tag_ids, 'custom_steps': @scenario_steps})
76
76
  end
77
77
  end
78
78
 
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '1.0.17'.freeze
2
+ VERSION = '1.0.22'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itriagetestrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo