inferno_core 0.4.7.pre → 0.4.8

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
  SHA256:
3
- metadata.gz: 81d3665f7c48320711d67f219dec844a704ff4147ffb1d8eaccf958f9d8a6d51
4
- data.tar.gz: 3ed608d8d2069f83c5319fefd32622b6d2524351a4ee3bf0a746f490223a1b50
3
+ metadata.gz: e9fb2c95aa9d590f9c05ceb25a236f0552ae2a94e91c49de3a116dbe970e62de
4
+ data.tar.gz: e81873f6d4c4a4b620fa2831298ce089567d07df5e2ca93b70cec127c2f67fbf
5
5
  SHA512:
6
- metadata.gz: 7039a46877f255f0190a9e8ccd4a028a29bb631a4a728231729ee1176b13754ad600c8a59051a73789f59c9586679e68936173df7eef8d6e8c440c6eacc5f718
7
- data.tar.gz: 4096d5d4e4a9fe8718cead9eec507d1f3f47785a00c893a83f8d7c2996fdcc713e3008a185fad31e8e0612200d375eb3d1c03c568c6cce79590ffe9b5a42dd22
6
+ metadata.gz: b5195ed44f0fb45fa7688e5dd3f4c74cc5012a689205cf39f27ab08a1ca25713cc4ce7a2c1351a281c311b38e38c28b72b5e09cf1771f88a220ebd6735ff87fd
7
+ data.tar.gz: 96b4316208dd689aad2e1205ac29c15e452d0086f72bbe1dff8ee349eccf5c579165bf7610196dfdb1cfcd2e959ad8d536e2978d8a00c60e598551a619447a34
@@ -1,3 +1,5 @@
1
+ require 'tty-markdown'
2
+
1
3
  require_relative 'suite_input_template'
2
4
 
3
5
  module Inferno
@@ -12,8 +14,44 @@ module Inferno
12
14
  LONGDESC
13
15
  option :filename, banner: '<filename>', aliases: [:f]
14
16
  def input_template(suite_id)
17
+ ENV['NO_DB'] = 'true'
15
18
  SuiteInputTemplate.new.run(suite_id, options)
16
19
  end
20
+
21
+ desc 'describe SUITE_ID', 'Show information about a suite'
22
+ long_desc <<~LONGDESC
23
+ Display a suite's description and available options.
24
+ LONGDESC
25
+ def describe(suite_id)
26
+ ENV['NO_DB'] = 'true'
27
+ Inferno::Application.start(:suites)
28
+
29
+ suite = Inferno::Repositories::TestSuites.new.find(suite_id)
30
+
31
+ if suite.blank?
32
+ message = "No suite found with id `#{suite_id}`. Run `inferno suites` to see a list of available suites"
33
+
34
+ puts TTY::Markdown.parse(message)
35
+ return
36
+ end
37
+
38
+ description = ''
39
+ description += "# #{suite.title}\n"
40
+ description += "#{suite.description}\n" if suite.description
41
+
42
+ if suite.suite_options.present?
43
+ description += "***\n\n"
44
+ description += "# Suite Options\n\n"
45
+ suite.suite_options.each do |option|
46
+ description += "* `#{option.id}`: #{option.title}\n"
47
+ option.list_options.each do |list_option|
48
+ description += " * `#{list_option[:value]}`: #{list_option[:label]}\n"
49
+ end
50
+ end
51
+ end
52
+
53
+ puts TTY::Markdown.parse(description)
54
+ end
17
55
  end
18
56
  end
19
57
  end
@@ -1,7 +1,11 @@
1
+ require 'tty-markdown'
2
+
1
3
  module Inferno
2
4
  module CLI
3
5
  class Suites
4
6
  def run
7
+ ENV['NO_DB'] = 'true'
8
+
5
9
  require_relative '../../../inferno'
6
10
 
7
11
  Inferno::Application.start(:suites)
@@ -9,14 +13,18 @@ module Inferno
9
13
  suites = Inferno::Repositories::TestSuites.new.all
10
14
  suite_hash = suites.each_with_object({}) { |suite, hash| hash[suite.id] = suite.title }
11
15
 
12
- id_column_length = suite_hash.keys.map(&:length).max + 1
13
- title_column_length = suite_hash.values.map(&:length).max
16
+ id_column_length = suite_hash.keys.map(&:length).max + 2
17
+ title_column_length = suite_hash.values.map(&:length).max + 1
18
+
19
+ output = ''
20
+ output += "| #{'Title'.ljust(title_column_length)}| #{'ID'.ljust(id_column_length)}|\n"
21
+ output += "|-#{'-' * title_column_length}|-#{'-' * id_column_length}|\n"
14
22
 
15
- puts "#{'ID'.ljust(id_column_length)}| Title"
16
- puts "#{'-' * id_column_length}+-#{'-' * title_column_length}"
17
23
  suite_hash.each do |id, title|
18
- puts "#{id.ljust(id_column_length)}| #{title}"
24
+ output += "| #{title.ljust(title_column_length)}| #{id.ljust(id_column_length)}|\n"
19
25
  end
26
+
27
+ puts TTY::Markdown.parse(output)
20
28
  end
21
29
  end
22
30
  end
@@ -14,7 +14,7 @@ module Inferno
14
14
 
15
15
  session = repo.create(create_params(params))
16
16
 
17
- repo.apply_preset(session.id, params[:preset_id]) if params[:preset_id].present?
17
+ repo.apply_preset(session, params[:preset_id]) if params[:preset_id].present?
18
18
 
19
19
  res.body = serialize(session)
20
20
  rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation => e
@@ -32,7 +32,7 @@ module Inferno
32
32
  halt 404
33
33
  end
34
34
 
35
- test_sessions_repo.apply_preset(test_session_id, preset_id)
35
+ test_sessions_repo.apply_preset(test_session, preset_id)
36
36
  res.status = 200
37
37
  end
38
38
  end
@@ -8,9 +8,10 @@ module Inferno
8
8
  # @param input_params [Hash] options for input such as type, description, or title
9
9
  # @option input_params [String] :title Human readable title for input
10
10
  # @option input_params [String] :description Description for the input
11
- # @option input_params [String] :type text | textarea | radio
11
+ # @option input_params [String] :type text | textarea | radio | oauth_credentials
12
12
  # @option input_params [String] :default The default value for the input
13
13
  # @option input_params [Boolean] :optional Set to true to not require input for test execution
14
+ # @option input_params [Boolean] :locked If true, the user can not alter the value
14
15
  # @option input_params [Hash] :options Possible input option formats based on input type
15
16
  # @option options [Array] :list_options Array of options for input formats that require a list of possible values
16
17
  # @return [void]
@@ -121,7 +121,7 @@ module Inferno
121
121
  expires_in = token_response_body['expires_in'].is_a?(Numeric) ? token_response_body['expires_in'] : nil
122
122
 
123
123
  self.access_token = token_response_body['access_token']
124
- self.refresh_token = token_response_body['refresh_token']
124
+ self.refresh_token = token_response_body['refresh_token'] if token_response_body['refresh_token'].present?
125
125
  self.expires_in = expires_in
126
126
  self.token_retrieval_time = DateTime.now
127
127
 
@@ -1,6 +1,5 @@
1
1
  require_relative '../dsl'
2
2
  require_relative '../repositories/test_groups'
3
- require_relative '../repositories/test_sessions'
4
3
 
5
4
  module Inferno
6
5
  module Entities