inferno_core 0.4.27 → 0.4.29

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: d2750c56074f5e6579f3fec5688d7c7c8ef909402a309ce6863da431f572600e
4
- data.tar.gz: b883711988bca2af75e2da203b0a6c4f34352470e57f99bb83d71927f5c7851c
3
+ metadata.gz: 71ffd4d8151e890a5a52cd087d5aeb222efcf27902c2ec01f78d898a08de7d9b
4
+ data.tar.gz: afe5c2b4cf3603e54e4b085dc609f061d6e78bd929e1b4ee915294dcb0f87de6
5
5
  SHA512:
6
- metadata.gz: 1196b955b46936d636ca1f6a4d781b15928bd2cc5710cadf852b09f8633202070793dfa24a3b531f668994d8ec9d9abd105b49fc5e47f08557c83b24c2d07a4b
7
- data.tar.gz: 9b5a566d027f0cd3f446025dc71bcf6844a03f46ff0cbf6d3d25a150ef9ca154fb06e84e841a9786f7a2d2495a7da273150bae329552a7229d9de60c36574f1c
6
+ metadata.gz: e0caf2d09c500643311b393129a741a9bd8d3ee043d7b6e45c3cad5cd92eb50802642de5c3222bf62188d1ecbe48469c5b54cf2f3005f65548d544b8ac2f6d30
7
+ data.tar.gz: bb530410e8303d6fc82132c0f8c3da0fc63987ac6ba48b2be1023d8021ed7350a5158d3941e5bc7090136986248bae9134a64fbf8c6432352bb98ae839abff91
@@ -3,6 +3,8 @@ require_relative 'migration'
3
3
  require_relative 'services'
4
4
  require_relative 'suite'
5
5
  require_relative 'suites'
6
+ require_relative 'new'
7
+ require_relative '../../version'
6
8
 
7
9
  module Inferno
8
10
  module CLI
@@ -49,6 +51,13 @@ module Inferno
49
51
 
50
52
  desc 'suite SUBCOMMAND ...ARGS', 'Perform suite-based operations'
51
53
  subcommand 'suite', Suite
54
+
55
+ register(New, 'new', 'new TEST_KIT_NAME', 'Run `inferno new --help` for full help')
56
+
57
+ desc 'version', "Output Inferno core version (#{Inferno::VERSION})"
58
+ def version
59
+ puts "Inferno Core v#{Inferno::VERSION}"
60
+ end
52
61
  end
53
62
  end
54
63
  end
@@ -0,0 +1,103 @@
1
+ require 'thor'
2
+ require 'bundler'
3
+ require_relative '../../utils/named_thor_actions'
4
+ require_relative '../../version'
5
+
6
+ module Inferno
7
+ module CLI
8
+ class New < Thor::Group
9
+ include Thor::Actions
10
+ include Inferno::Utils::NamedThorActions
11
+
12
+ desc <<~HELP
13
+ Generate a new Inferno test kit for FHIR software testing
14
+
15
+ Examples:
16
+
17
+ `inferno new test_fhir_app`
18
+ => generates an Inferno app
19
+
20
+ `inferno new test_my_ig -a MyName`
21
+ => generates Inferno app and specifies MyName as gemspec author
22
+
23
+ https://inferno-framework.github.io/index.html
24
+ HELP
25
+
26
+ def self.banner
27
+ 'inferno new TEST_KIT_NAME'
28
+ end
29
+
30
+ def self.source_root
31
+ File.join(__dir__, 'templates')
32
+ end
33
+
34
+ argument :name,
35
+ type: :string,
36
+ required: true,
37
+ desc: 'name for new Inferno project'
38
+ class_option :author,
39
+ type: :string,
40
+ aliases: '-a',
41
+ default: [],
42
+ repeatable: true,
43
+ desc: "Author names for gemspec file; you may use '-a' multiple times"
44
+ class_option :skip_bundle,
45
+ type: :boolean,
46
+ aliases: '-b',
47
+ default: false,
48
+ desc: 'Do not run bundle install'
49
+
50
+ add_runtime_options!
51
+
52
+ def create_app
53
+ directory('.', root_name, { mode: :preserve, recursive: true, verbose: !options['quiet'] })
54
+
55
+ bundle_install
56
+ inferno_migrate
57
+
58
+ say_unless_quiet "Created #{root_name} Inferno test kit!", :green
59
+
60
+ return unless options['pretend']
61
+
62
+ say_unless_quiet 'This was a dry run; re-run without `--pretend` to actually create project',
63
+ :yellow
64
+ end
65
+
66
+ private
67
+
68
+ def ig_path
69
+ File.join('lib', library_name, 'igs')
70
+ end
71
+
72
+ def authors
73
+ options['author'].presence || [default_author]
74
+ end
75
+
76
+ def default_author
77
+ ENV['USER'] || ENV['USERNAME'] || 'PUT_YOUR_NAME_HERE'
78
+ end
79
+
80
+ def bundle_install
81
+ return if options['skip_bundle']
82
+
83
+ inside(root_name) do
84
+ Bundler.with_unbundled_env do
85
+ run 'bundle install', verbose: !options['quiet'], capture: options['quiet']
86
+ end
87
+ end
88
+ end
89
+
90
+ def inferno_migrate
91
+ return if options['skip_bundle']
92
+
93
+ inside(root_name) do
94
+ run 'bundle exec inferno migrate', verbose: !options['quiet'], capture: options['quiet']
95
+ end
96
+ end
97
+
98
+ def say_unless_quiet(*args)
99
+ say(*args) unless options['quiet']
100
+ end
101
+ end
102
+ end
103
+ end
@@ -21,7 +21,7 @@ module Inferno
21
21
 
22
22
  if test_run_is_waiting
23
23
  waiting_result = results_repo.find_waiting_result(test_run_id: test_run.id)
24
- results_repo.cancel_waiting_result(waiting_result.id, 'Test cancelled by user')
24
+ results_repo.update_result(waiting_result.id, 'cancel', 'Test cancelled by user')
25
25
  Jobs.perform(Jobs::ResumeTestRun, test_run.id)
26
26
  end
27
27
 
@@ -45,7 +45,7 @@ module Inferno
45
45
  # @param validator_url [String]
46
46
  def url(validator_url = nil)
47
47
  @url = validator_url if validator_url
48
-
48
+ @url ||= default_validator_url
49
49
  @url
50
50
  end
51
51
 
@@ -60,7 +60,7 @@ module Inferno
60
60
  # @param validator_url [String]
61
61
  def url(validator_url = nil)
62
62
  @url = validator_url if validator_url
63
-
63
+ @url ||= default_validator_url
64
64
  @url
65
65
  end
66
66
 
@@ -28,6 +28,11 @@ module Inferno
28
28
  self.class.singleton_class.instance_variable_get(:@tags)
29
29
  end
30
30
 
31
+ # @private
32
+ def result
33
+ self.class.singleton_class.instance_variable_get(:@result)
34
+ end
35
+
31
36
  # @private
32
37
  def find_test_run(test_run_identifier)
33
38
  test_runs_repo.find_latest_waiting_by_identifier(test_run_identifier)
@@ -40,7 +45,7 @@ module Inferno
40
45
 
41
46
  # @private
42
47
  def update_result(waiting_result)
43
- results_repo.pass_waiting_result(waiting_result.id)
48
+ results_repo.update_result(waiting_result.id, result)
44
49
  end
45
50
 
46
51
  # @private
@@ -342,16 +342,19 @@ module Inferno
342
342
  # Router](https://github.com/hanami/router/tree/f41001d4c3ee9e2d2c7bb142f74b43f8e1d3a265#a-beautiful-dsl)
343
343
  # can be used here.
344
344
  # @param tags [Array<String>] a list of tags to assign to the request
345
+ # @param result [String] the result for the waiting test. Must be one of:
346
+ # 'pass', 'fail', 'skip', 'omit', 'cancel'
345
347
  # @yield This method takes a block which must return the identifier
346
348
  # defined when a test was set to wait for the test run that hit this
347
349
  # route. The block has access to the `request` method which returns a
348
350
  # {Inferno::Entities::Request} object with the information for the
349
351
  # incoming request.
350
352
  # @return [void]
351
- def resume_test_route(method, path, tags: [], &block)
353
+ def resume_test_route(method, path, tags: [], result: 'pass', &block)
352
354
  route_class = Class.new(ResumeTestRoute) do |klass|
353
355
  klass.singleton_class.instance_variable_set(:@test_run_identifier_block, block)
354
356
  klass.singleton_class.instance_variable_set(:@tags, tags)
357
+ klass.singleton_class.instance_variable_set(:@result, result)
355
358
  end
356
359
 
357
360
  route(method, path, route_class)