hiptest-publisher 0.15.6 → 0.15.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fbc40768c2c96bb4a94eb5c5ba49db3527c316a
4
- data.tar.gz: b58da722087d2766275d655f85a9609cac16133e
3
+ metadata.gz: 4d15ddd789a95a8a6484b2a99d7d446914274d9f
4
+ data.tar.gz: 3ccf814c65f0cbedbb2af7a0e82b8d5e25883834
5
5
  SHA512:
6
- metadata.gz: 5a934f7b2fcdd6df697a78c41622c878c383def29e654575810bdc6d1ec5f4d9d2a8d68e73181286e7d03c89ee54eb4221a2edc9cba2d21f3dc38079b4ba4302
7
- data.tar.gz: 695dfc78e7bf8f7ab0eff95898c3427b16ce04c9d073c222752503fbfb02ef234856a5170f4b39378f0ae0b892fe293a4ddae0305d6c9283d0bacc01dafaf488
6
+ metadata.gz: 0788387b0e1e6d4ce4fe44585eb8293ca3e25d0268966fbba22bcfdaab0ecf081300fc9052fb3c8e5907a96021afbc5e6ecc7d247d976a1d104a0722ab897498
7
+ data.tar.gz: f0df0e4dcec6e0d1e1a1b501a981d11bd27633161957da75190f6f639d70dde118f7f34986d84a9ffbfe321fb22e6d8089a1eb9581aa408a35ed9f985bc359e9
@@ -29,14 +29,21 @@ module Hiptest
29
29
 
30
30
  def fetch_project_export
31
31
  response = send_get_request(url)
32
+ if response.code_type == Net::HTTPNotFound
33
+ raise ClientError, "No project found with this secret token."
34
+ end
32
35
  response.body
33
36
  end
34
37
 
35
38
  def available_test_runs
36
39
  @available_test_runs ||= begin
37
40
  response = send_get_request("#{base_publication_path}/test_runs")
38
- json_response = JSON.parse(response.body)
39
- json_response["test_runs"]
41
+ if response.code_type == Net::HTTPNotFound
42
+ :api_not_available
43
+ else
44
+ json_response = JSON.parse(response.body)
45
+ json_response["test_runs"]
46
+ end
40
47
  end
41
48
  end
42
49
 
@@ -64,11 +71,19 @@ module Hiptest
64
71
  searched_value = cli_options.test_run_name
65
72
  end
66
73
 
67
- matching_test_run = available_test_runs.find { |test_run| test_run[key] == searched_value }
68
- if matching_test_run.nil?
69
- raise ClientError, no_matching_test_runs_error_message
74
+ if available_test_runs == :api_not_available
75
+ if cli_options.test_run_id?
76
+ cli_options.test_run_id
77
+ else
78
+ raise ClientError, "Cannot get the list of available test runs from Hiptest. Try using --test-run-id instead of --test-run-name"
79
+ end
80
+ else
81
+ matching_test_run = available_test_runs.find { |test_run| test_run[key] == searched_value }
82
+ if matching_test_run.nil?
83
+ raise ClientError, no_matching_test_runs_error_message
84
+ end
85
+ matching_test_run["id"]
70
86
  end
71
- matching_test_run["id"]
72
87
  end
73
88
 
74
89
  def no_matching_test_runs_error_message
@@ -97,9 +112,6 @@ module Hiptest
97
112
  def send_get_request(url)
98
113
  uri = URI.parse(url)
99
114
  response = send_request(Net::HTTP::Get.new(uri))
100
- if response.code_type == Net::HTTPNotFound
101
- raise ClientError, "No project found with this secret token."
102
- end
103
115
  response
104
116
  end
105
117
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.6
4
+ version: 0.15.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize