diff --git a/.dockerignore b/.dockerignore index 8b28d19f4..27fbf4596 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ /db/*.db -/public/assets* /tmp .env.local .env.*.local @@ -14,8 +13,9 @@ .idea /coverage +/data /docs/yard -.yardoc +/.yardoc /node_modules /.git /.github diff --git a/.env.development b/.env.development index ac5e15c07..b9f116d9a 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,4 @@ +LOAD_DEV_SUITES=true +LOAD_UI_SUITES=true VALIDATOR_URL=https://inferno.healthit.gov/validatorapi JS_HOST=http://localhost:3000 \ No newline at end of file diff --git a/.env.test b/.env.test index e83c4d8a0..2ed364419 100644 --- a/.env.test +++ b/.env.test @@ -1 +1,2 @@ +LOAD_DEV_SUITES=true VALIDATOR_URL=https://example.com/validatorapi diff --git a/.gitignore b/.gitignore index 54c7607be..746685df7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +/data/*.db /db/*.db -/public/assets* +/lib/inferno/public/assets* +/lib/inferno/public/*.js +/lib/inferno/public/*.LICENSE.txt +/lib/inferno/public/*.png +!/lib/inferno/public/logo*.png /tmp .env.local .env.*.local diff --git a/.rubocop.yml b/.rubocop.yml index 17f59cda7..786f3a9d7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,16 +13,15 @@ AllCops: Layout/LineLength: Max: 120 Exclude: - - 'dev_suites/onc_program/**/*' - - 'suites/ips/**/*' - - 'dev_suites/smart_scheduling_links/**/*' + - 'ui_suites/onc_program/**/*' + - 'ui_suites/smart_scheduling_links/**/*' Layout/MultilineMethodCallIndentation: EnforcedStyle: 'indented' Lint/EmptyBlock: Exclude: - - 'dev_suites/onc_program/**/*' + - 'ui_suites/onc_program/**/*' Style/BlockComments: Exclude: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..e3ccc9446 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# 0.0.1 + +* Initial gem release diff --git a/Gemfile b/Gemfile index c74758114..86d545f11 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '2.7.2' -gem 'dry-system', '~> 0.17', require: 'dry/system/container' +gem 'dry-system', '0.18.1' gem 'sqlite3' gem 'sequel' @@ -13,7 +13,7 @@ gem 'hanami-router', '~> 1.3' gem 'oj' gem 'puma' -gem 'activesupport', require: 'active_support/all' +gem 'activesupport' gem 'dotenv' gem 'fhir_client' gem 'rake' diff --git a/Gemfile.lock b/Gemfile.lock index ef457d7ae..5d051d574 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -237,7 +237,7 @@ DEPENDENCIES codecov database_cleaner-sequel dotenv - dry-system (~> 0.17) + dry-system (= 0.18.1) factory_bot faraday fhir_client diff --git a/README.md b/README.md index 84409e606..918477c2a 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ GET http://localhost:4567/api/test_sessions/TEST_SESSION_ID/results ``` ## Development -To get to an interactive console, run `bundle exec bin/console` +To get to an interactive console, run `bundle exec bin/inferno-console` ## License Copyright 2021 The MITRE Corporation diff --git a/Rakefile b/Rakefile index b72119601..ea4cfe09f 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,7 @@ end namespace :db do desc 'Apply changes to the database' task :migrate do - require_relative 'config/application' + require_relative 'lib/inferno/app/config/application' Inferno::Application.start(:db) end diff --git a/bin/console b/bin/console deleted file mode 100755 index a8c0da418..000000000 --- a/bin/console +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require_relative '../config/application' - -Inferno::Application.finalize! - -binding.pry # rubocop:disable Lint/Debugger diff --git a/bin/inferno-console b/bin/inferno-console new file mode 100755 index 000000000..a8dd2c75f --- /dev/null +++ b/bin/inferno-console @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby + +require 'pry' +require_relative '../lib/inferno' + +Inferno::Application.finalize! + +Pry.start diff --git a/config.ru b/config.ru index 4c015a00a..211de7d24 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,6 @@ -require_relative 'config/application' +require_relative 'lib/inferno' -use Rack::Static, urls: ['/public'] +use Rack::Static, urls: ['/public'], root: 'lib/inferno' Inferno::Application.finalize! diff --git a/config/boot.rb b/config/boot.rb deleted file mode 100644 index f22da75b2..000000000 --- a/config/boot.rb +++ /dev/null @@ -1,7 +0,0 @@ -ENV['APP_ENV'] ||= 'development' - -require 'bundler' -Bundler.setup(:default, ENV['APP_ENV']) -Bundler.require(:default, ENV['APP_ENV']) - -Dotenv.load('.env', ".env.#{ENV['APP_ENV']}") diff --git a/config/boot/entities.rb b/config/boot/entities.rb deleted file mode 100644 index 6104b65f7..000000000 --- a/config/boot/entities.rb +++ /dev/null @@ -1,11 +0,0 @@ -Inferno::Application.boot(:entities) do - init do - require_relative(File.join(Inferno::Application.root, 'lib', 'inferno', 'exceptions')) - - require_relative(File.join(Inferno::Application.root, 'lib', 'inferno', 'entities', 'attributes.rb')) - require_relative(File.join(Inferno::Application.root, 'lib', 'inferno', 'entities', 'entity.rb')) - Dir.glob(File.join(Inferno::Application.root, 'lib', 'inferno', 'entities', '*')).each do |path| - require_relative path - end - end -end diff --git a/config/boot/suites.rb b/config/boot/suites.rb deleted file mode 100644 index a38a04cb4..000000000 --- a/config/boot/suites.rb +++ /dev/null @@ -1,50 +0,0 @@ -require_relative '../../lib/inferno/utils/suite_tracker' - -Inferno::Application.boot(:suites) do - init do - use :logging, :entities - - files_to_load = Dir.glob(File.join(Inferno::Application.root, 'suites', '**', '*.rb')) - - if ENV['APP_ENV'] != 'production' - files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'dev_suites', '**', '*.rb')) - end - - if ENV['APP_ENV'] == 'test' - files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'spec', 'fixtures', '**', '*.rb')) - end - - previous_length = 0 - - while files_to_load.length != previous_length - previous_length = files_to_load.length - files_to_load.reject! do |path| - require_relative path - Inferno::Utils::SuiteTracker.classes_defined_at_path[path].each(&:add_self_to_repository) - true - rescue Inferno::Exceptions::ParentNotLoadedException, NameError - # Clear out the inline Test DSL classes, which will be added again on - # the next pass. - Inferno::Utils::SuiteTracker.classes_defined_at_path[path].delete_if { |klass| klass.name.nil? } - false - end - end - - ObjectSpace.each_object(TracePoint, &:disable) - - unless files_to_load.empty? - error_messages = files_to_load.each_with_object({}) do |path, errors| - require_relative path - rescue StandardError => e - errors[path] = "#{e.message} -- #{e.backtrace_locations.first}" - end - - error_message = - error_messages - .map { |path, message| "Unable to load #{path}: #{message}" } - .join("\n") - - raise StandardError, error_message - end - end -end diff --git a/config/database.yml b/config/database.yml index c5b5f0c92..a7cb52137 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,6 +1,6 @@ development: adapter: sqlite - database: db/inferno_development.db + database: data/inferno_development.db max_connections: 10 # user: # password: @@ -9,7 +9,7 @@ development: production: adapter: sqlite - database: db/inferno_production.db + database: ':memory:' max_connections: 10 test: diff --git a/data/.keep b/data/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/dev_suites/demo_ig_stu1/demo_suite.rb b/dev_suites/demo_ig_stu1/demo_suite.rb index cd0099b7b..4142a847e 100644 --- a/dev_suites/demo_ig_stu1/demo_suite.rb +++ b/dev_suites/demo_ig_stu1/demo_suite.rb @@ -1,3 +1,5 @@ +require_relative 'groups/demo_group' + module DemoIG_STU1 # rubocop:disable Naming/ClassAndModuleCamelCase class DemoSuite < Inferno::TestSuite title 'Demonstration Suite' diff --git a/dev_suites/infrastructure_test/external_inner_group.rb b/dev_suites/infrastructure_test/external_inner_group.rb index 2b5051731..b42853ea2 100644 --- a/dev_suites/infrastructure_test/external_inner_group.rb +++ b/dev_suites/infrastructure_test/external_inner_group.rb @@ -1,3 +1,5 @@ +require_relative 'external_test1' + module InfrastructureTest class ExternalInnerGroup < Inferno::TestGroup id 'external_inner_group' diff --git a/dev_suites/infrastructure_test/external_outer_group.rb b/dev_suites/infrastructure_test/external_outer_group.rb index 7fbbb16e0..ad2681e9a 100644 --- a/dev_suites/infrastructure_test/external_outer_group.rb +++ b/dev_suites/infrastructure_test/external_outer_group.rb @@ -1,3 +1,5 @@ +require_relative 'external_inner_group' + module InfrastructureTest class ExternalOuterGroup < Inferno::TestGroup id 'external_outer_group' diff --git a/dev_suites/infrastructure_test/infrastructure_test.rb b/dev_suites/infrastructure_test/infrastructure_test.rb index 0deff8d6e..246a2763b 100644 --- a/dev_suites/infrastructure_test/infrastructure_test.rb +++ b/dev_suites/infrastructure_test/infrastructure_test.rb @@ -1,3 +1,5 @@ +require_relative 'external_outer_group' + module InfrastructureTest class Suite < Inferno::TestSuite id 'infra_test' diff --git a/inferno_core.gemspec b/inferno_core.gemspec new file mode 100644 index 000000000..af4fff9a7 --- /dev/null +++ b/inferno_core.gemspec @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +require_relative 'lib/inferno/version' +require 'rake' + +Gem::Specification.new do |spec| + spec.name = 'inferno_core' + spec.version = Inferno::VERSION + spec.authors = ['Stephen MacVicar', 'Robert Scanlon', 'Chase Zhou'] + spec.email = ['inferno@groups.mitre.org'] + spec.date = Time.now.utc.strftime('%Y-%m-%d') + spec.summary = 'Inferno Core is an open source tool for testing data exchanges enabled by the FHIR standand' + spec.description = 'Inferno Core is an open source tool for testing data exchanges enabled by the FHIR standand' + spec.homepage = 'https://github.com/inferno_community/inferno-core' + spec.license = 'Apache 2.0' + spec.add_runtime_dependency 'activesupport' + spec.add_runtime_dependency 'blueprinter' + spec.add_runtime_dependency 'dotenv' + spec.add_runtime_dependency 'dry-system', '0.18.1' + spec.add_runtime_dependency 'faraday' + spec.add_runtime_dependency 'fhir_client' + spec.add_runtime_dependency 'hanami-controller', '~> 1.3' + spec.add_runtime_dependency 'hanami-router', '~> 1.3' + spec.add_runtime_dependency 'oj' + spec.add_runtime_dependency 'pry' + spec.add_runtime_dependency 'pry-byebug' + spec.add_runtime_dependency 'puma' + spec.add_runtime_dependency 'rake' + spec.add_runtime_dependency 'sequel' + spec.add_runtime_dependency 'sqlite3' + spec.add_development_dependency 'codecov' + spec.add_development_dependency 'database_cleaner-sequel' + spec.add_development_dependency 'factory_bot' + spec.add_development_dependency 'rack-test' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'rubocop', '~> 1.9' + spec.add_development_dependency 'rubocop-rake' + spec.add_development_dependency 'rubocop-rspec' + spec.add_development_dependency 'rubocop-sequel' + spec.add_development_dependency 'simplecov' + spec.add_development_dependency 'webmock' + spec.add_development_dependency 'yard' + spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0') + spec.metadata['homepage_uri'] = spec.homepage + spec.metadata['source_code_uri'] = 'https://github.com/inferno_community/inferno-core' + spec.metadata['changelog_uri'] = 'https://github.com/inferno_community/inferno-core/CHANGELOG.md' + spec.files = [ + 'lib/inferno.rb', + 'LICENSE.txt', + Dir['lib/inferno/**/*.rb'], + 'bin/inferno-console', + Dir['lib/inferno/public/*.png'], + Dir['lib/inferno/public/*.ico'], + Dir['lib/inferno/public/*.js'], + 'lib/inferno/public/bundle.js.LICENSE.txt', + 'lib/inferno/public/assets.json', + 'spec/support/factory_bot.rb', + Dir['spec/support/factories/**.*.rb'] + ].flatten + + spec.bindir = 'bin' + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.require_paths = ['lib', 'spec'] +end diff --git a/lib/inferno.rb b/lib/inferno.rb index 2b24e52b1..64f62fce0 100644 --- a/lib/inferno.rb +++ b/lib/inferno.rb @@ -1,2 +1,15 @@ +require 'active_support/all' +require 'dotenv' +require 'dry/system/container' +require 'sequel' +require_relative 'inferno/config/application' +require_relative 'inferno/dsl' +require_relative 'inferno/entities' +require_relative 'inferno/exceptions' +require_relative 'inferno/repositories' +require_relative 'inferno/spec_support' +require_relative 'inferno/test_runner' +require_relative 'inferno/version' + module Inferno end diff --git a/apps/web/application.rb b/lib/inferno/apps/web/application.rb similarity index 100% rename from apps/web/application.rb rename to lib/inferno/apps/web/application.rb diff --git a/apps/web/controllers/controller.rb b/lib/inferno/apps/web/controllers/controller.rb similarity index 100% rename from apps/web/controllers/controller.rb rename to lib/inferno/apps/web/controllers/controller.rb diff --git a/apps/web/controllers/requests/show.rb b/lib/inferno/apps/web/controllers/requests/show.rb similarity index 100% rename from apps/web/controllers/requests/show.rb rename to lib/inferno/apps/web/controllers/requests/show.rb diff --git a/apps/web/controllers/test_runs/create.rb b/lib/inferno/apps/web/controllers/test_runs/create.rb similarity index 100% rename from apps/web/controllers/test_runs/create.rb rename to lib/inferno/apps/web/controllers/test_runs/create.rb diff --git a/apps/web/controllers/test_runs/results/index.rb b/lib/inferno/apps/web/controllers/test_runs/results/index.rb similarity index 100% rename from apps/web/controllers/test_runs/results/index.rb rename to lib/inferno/apps/web/controllers/test_runs/results/index.rb diff --git a/apps/web/controllers/test_runs/show.rb b/lib/inferno/apps/web/controllers/test_runs/show.rb similarity index 100% rename from apps/web/controllers/test_runs/show.rb rename to lib/inferno/apps/web/controllers/test_runs/show.rb diff --git a/apps/web/controllers/test_sessions/create.rb b/lib/inferno/apps/web/controllers/test_sessions/create.rb similarity index 100% rename from apps/web/controllers/test_sessions/create.rb rename to lib/inferno/apps/web/controllers/test_sessions/create.rb diff --git a/apps/web/controllers/test_sessions/results/index.rb b/lib/inferno/apps/web/controllers/test_sessions/results/index.rb similarity index 100% rename from apps/web/controllers/test_sessions/results/index.rb rename to lib/inferno/apps/web/controllers/test_sessions/results/index.rb diff --git a/apps/web/controllers/test_sessions/show.rb b/lib/inferno/apps/web/controllers/test_sessions/show.rb similarity index 100% rename from apps/web/controllers/test_sessions/show.rb rename to lib/inferno/apps/web/controllers/test_sessions/show.rb diff --git a/apps/web/controllers/test_suites/index.rb b/lib/inferno/apps/web/controllers/test_suites/index.rb similarity index 100% rename from apps/web/controllers/test_suites/index.rb rename to lib/inferno/apps/web/controllers/test_suites/index.rb diff --git a/apps/web/controllers/test_suites/show.rb b/lib/inferno/apps/web/controllers/test_suites/show.rb similarity index 100% rename from apps/web/controllers/test_suites/show.rb rename to lib/inferno/apps/web/controllers/test_suites/show.rb diff --git a/apps/web/index.html.erb b/lib/inferno/apps/web/index.html.erb similarity index 100% rename from apps/web/index.html.erb rename to lib/inferno/apps/web/index.html.erb diff --git a/apps/web/router.rb b/lib/inferno/apps/web/router.rb similarity index 85% rename from apps/web/router.rb rename to lib/inferno/apps/web/router.rb index ccca819f6..e286564a2 100644 --- a/apps/web/router.rb +++ b/lib/inferno/apps/web/router.rb @@ -2,7 +2,8 @@ module Inferno module Web - client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'apps', 'web', 'index.html.erb'))).result + client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'lib', 'inferno', 'apps', 'web', + 'index.html.erb'))).result Router = Hanami::Router.new(namespace: Inferno::Web::Controllers) do namespace 'api' do diff --git a/apps/web/serializers/header.rb b/lib/inferno/apps/web/serializers/header.rb similarity index 100% rename from apps/web/serializers/header.rb rename to lib/inferno/apps/web/serializers/header.rb diff --git a/apps/web/serializers/input.rb b/lib/inferno/apps/web/serializers/input.rb similarity index 100% rename from apps/web/serializers/input.rb rename to lib/inferno/apps/web/serializers/input.rb diff --git a/apps/web/serializers/message.rb b/lib/inferno/apps/web/serializers/message.rb similarity index 100% rename from apps/web/serializers/message.rb rename to lib/inferno/apps/web/serializers/message.rb diff --git a/apps/web/serializers/request.rb b/lib/inferno/apps/web/serializers/request.rb similarity index 100% rename from apps/web/serializers/request.rb rename to lib/inferno/apps/web/serializers/request.rb diff --git a/apps/web/serializers/result.rb b/lib/inferno/apps/web/serializers/result.rb similarity index 100% rename from apps/web/serializers/result.rb rename to lib/inferno/apps/web/serializers/result.rb diff --git a/apps/web/serializers/serializer.rb b/lib/inferno/apps/web/serializers/serializer.rb similarity index 100% rename from apps/web/serializers/serializer.rb rename to lib/inferno/apps/web/serializers/serializer.rb diff --git a/apps/web/serializers/test.rb b/lib/inferno/apps/web/serializers/test.rb similarity index 100% rename from apps/web/serializers/test.rb rename to lib/inferno/apps/web/serializers/test.rb diff --git a/apps/web/serializers/test_group.rb b/lib/inferno/apps/web/serializers/test_group.rb similarity index 100% rename from apps/web/serializers/test_group.rb rename to lib/inferno/apps/web/serializers/test_group.rb diff --git a/apps/web/serializers/test_run.rb b/lib/inferno/apps/web/serializers/test_run.rb similarity index 100% rename from apps/web/serializers/test_run.rb rename to lib/inferno/apps/web/serializers/test_run.rb diff --git a/apps/web/serializers/test_session.rb b/lib/inferno/apps/web/serializers/test_session.rb similarity index 100% rename from apps/web/serializers/test_session.rb rename to lib/inferno/apps/web/serializers/test_session.rb diff --git a/apps/web/serializers/test_suite.rb b/lib/inferno/apps/web/serializers/test_suite.rb similarity index 100% rename from apps/web/serializers/test_suite.rb rename to lib/inferno/apps/web/serializers/test_suite.rb diff --git a/config/application.rb b/lib/inferno/config/application.rb similarity index 51% rename from config/application.rb rename to lib/inferno/config/application.rb index be55cbc69..1545874b2 100644 --- a/config/application.rb +++ b/lib/inferno/config/application.rb @@ -2,21 +2,21 @@ module Inferno class Application < Dry::System::Container + ::Inferno::Import = injector + use :env, inferrer: -> { ENV.fetch('APP_ENV', :development).to_sym } configure do |config| - config.root = File.expand_path('..', __dir__) + config.root = File.expand_path('../../..', __dir__) config.default_namespace = 'inferno' - config.system_dir = 'config' - config.bootable_dirs = [File.join('config', 'boot')] + config.system_dir = File.join('lib', 'inferno', 'config') + config.bootable_dirs = [File.join('lib', 'inferno', 'config', 'boot')] - config.auto_register = ['lib', 'apps'] + config.auto_register = 'lib' end Application.register('js_host', ENV.fetch('JS_HOST', '')) - load_paths!('lib', 'apps') + load_paths!('lib') end - - Import = Application.injector end diff --git a/lib/inferno/config/boot.rb b/lib/inferno/config/boot.rb new file mode 100644 index 000000000..b389e6144 --- /dev/null +++ b/lib/inferno/config/boot.rb @@ -0,0 +1,5 @@ +ENV['APP_ENV'] ||= 'development' + +root_path = Dir.pwd + +Dotenv.load(File.join(root_path, '.env'), File.join(root_path, ".env.#{ENV['APP_ENV']}")) diff --git a/config/boot/db.rb b/lib/inferno/config/boot/db.rb similarity index 73% rename from config/boot/db.rb rename to lib/inferno/config/boot/db.rb index bc57cb41d..63c2939f9 100644 --- a/config/boot/db.rb +++ b/lib/inferno/config/boot/db.rb @@ -6,7 +6,7 @@ Sequel::Model.plugin :json_serializer - config_path = File.expand_path('database.yml', File.join(Inferno::Application.root, 'config')) + config_path = File.expand_path('database.yml', File.join(Dir.pwd, 'config')) config = YAML.load_file(config_path)[ENV['APP_ENV']] .merge(logger: Inferno::Application['logger']) connection = Sequel.connect(config) @@ -17,7 +17,7 @@ start do Sequel.extension :migration - migration_path = File.join(Inferno::Application.root, 'db', 'migrations') + migration_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'migrations') Sequel::Migrator.run(Inferno::Application['db.connection'], migration_path) end end diff --git a/config/boot/logging.rb b/lib/inferno/config/boot/logging.rb similarity index 85% rename from config/boot/logging.rb rename to lib/inferno/config/boot/logging.rb index d4ee32534..4070ab68d 100644 --- a/config/boot/logging.rb +++ b/lib/inferno/config/boot/logging.rb @@ -2,7 +2,7 @@ init do logger = if Inferno::Application.env == :test - log_file_directory = File.join(Inferno::Application.root, 'tmp') + log_file_directory = File.join(Dir.pwd, 'tmp') FileUtils.mkdir_p(log_file_directory) log_file_path = File.join(log_file_directory, 'test.log') log_file = File.open(log_file_path, File::WRONLY | File::APPEND | File::CREAT) diff --git a/lib/inferno/config/boot/suites.rb b/lib/inferno/config/boot/suites.rb new file mode 100644 index 000000000..288ffc980 --- /dev/null +++ b/lib/inferno/config/boot/suites.rb @@ -0,0 +1,27 @@ +Inferno::Application.boot(:suites) do + init do + use :logging + + files_to_load = Dir.glob(File.join(Dir.pwd, 'lib', '*.rb')) + + if ENV['LOAD_DEV_SUITES'] == 'true' + files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'dev_suites', '**', '*.rb')) + end + + if ENV['LOAD_UI_SUITES'] == 'true' + files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'ui_suites', '**', '*.rb')) + end + + if ENV['APP_ENV'] == 'test' + files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'spec', 'fixtures', '**', '*.rb')) + end + + files_to_load.map! { |path| File.realpath(path) } + + files_to_load.each do |path| + require_relative path + end + + ObjectSpace.each_object(TracePoint, &:disable) + end +end diff --git a/config/boot/web.rb b/lib/inferno/config/boot/web.rb similarity index 100% rename from config/boot/web.rb rename to lib/inferno/config/boot/web.rb diff --git a/db/migrations/001_create_initial_structure.rb b/lib/inferno/db/migrations/001_create_initial_structure.rb similarity index 100% rename from db/migrations/001_create_initial_structure.rb rename to lib/inferno/db/migrations/001_create_initial_structure.rb diff --git a/lib/inferno/dsl/fhir_client_builder.rb b/lib/inferno/dsl/fhir_client_builder.rb index 59647d608..27324d544 100644 --- a/lib/inferno/dsl/fhir_client_builder.rb +++ b/lib/inferno/dsl/fhir_client_builder.rb @@ -1,3 +1,5 @@ +require 'fhir_client' + module Inferno module DSL # DSL for configuring FHIR clients diff --git a/lib/inferno/dsl/runnable.rb b/lib/inferno/dsl/runnable.rb index f8dc6f271..406fc956c 100644 --- a/lib/inferno/dsl/runnable.rb +++ b/lib/inferno/dsl/runnable.rb @@ -15,20 +15,6 @@ def self.extended(extending_class) super extending_class.define_singleton_method(:inherited) do |subclass| - # Whenever a Runnable class is defined, we need to clear out its - # instance variables. Runnable classes can fail to load becaus they - # depend on other Runnable classes which haven't been loaded yet. When - # this happens, any instance variables which were assigned before the - # failure remain, so they have to be removed so that the class starts - # with a clean slate when the next attempt to load it is made. - TracePoint.trace(:class) do |trace| - if trace.self == subclass - trace.self.instance_variables.each do |variable_name| - trace.self.instance_variable_set(variable_name, nil) - end - end - end - copy_instance_variables(subclass) # Whenever the definition of a Runnable class ends, keep track of the @@ -37,7 +23,7 @@ def self.extended(extending_class) # appropriate repositories. TracePoint.trace(:end) do |trace| if trace.self == subclass - Inferno::Utils::SuiteTracker.classes_defined_at_path[trace.path] << trace.self + subclass.add_self_to_repository trace.disable end end @@ -96,6 +82,8 @@ def define_child(*args, &block) handle_child_definition_block(klass, &block) + klass.add_self_to_repository + klass end @@ -168,14 +156,9 @@ def configure_child_class(klass, hash_args) # rubocop:disable Metrics/Cyclomatic klass.send(key, *value) end - file_path = - caller_locations - .find { |path| !path.path.include? '/lib/inferno/' } - .path - Inferno::Utils::SuiteTracker.classes_defined_at_path[file_path] << klass - klass.children.each do |child_class| klass.configure_child_class(child_class, {}) + child_class.add_self_to_repository end end diff --git a/lib/inferno/entities.rb b/lib/inferno/entities.rb index e0c5aee7e..d33bbd748 100644 --- a/lib/inferno/entities.rb +++ b/lib/inferno/entities.rb @@ -1,3 +1,16 @@ +require_relative 'entities/attributes' +require_relative 'entities/entity' +require_relative 'entities/header' +require_relative 'entities/message' +require_relative 'entities/request' +require_relative 'entities/result' +require_relative 'entities/test' +require_relative 'entities/test_group' +require_relative 'entities/test_input' +require_relative 'entities/test_run' +require_relative 'entities/test_session' +require_relative 'entities/test_suite' + module Inferno # Entities are domain objects whose identity is based on an `id`. Entities # don't know anything about persistence, which is handled by Repositories. diff --git a/public/217.bundle.js b/lib/inferno/public/217.bundle.js similarity index 100% rename from public/217.bundle.js rename to lib/inferno/public/217.bundle.js diff --git a/public/favicon.ico b/lib/inferno/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to lib/inferno/public/favicon.ico diff --git a/public/logo192.png b/lib/inferno/public/logo192.png similarity index 100% rename from public/logo192.png rename to lib/inferno/public/logo192.png diff --git a/public/logo512.png b/lib/inferno/public/logo512.png similarity index 100% rename from public/logo512.png rename to lib/inferno/public/logo512.png diff --git a/lib/inferno/repositories.rb b/lib/inferno/repositories.rb index ae89f9b54..bb940d33b 100644 --- a/lib/inferno/repositories.rb +++ b/lib/inferno/repositories.rb @@ -1,3 +1,16 @@ +require_relative 'repositories/in_memory_repository' +require_relative 'repositories/repository' +require_relative 'repositories/validate_runnable_reference' +require_relative 'repositories/headers' +require_relative 'repositories/messages' +require_relative 'repositories/requests' +require_relative 'repositories/results' +require_relative 'repositories/test_groups' +require_relative 'repositories/test_runs' +require_relative 'repositories/test_sessions' +require_relative 'repositories/test_suites' +require_relative 'repositories/tests' + module Inferno # Repositories provide an abstraction layer for dealing with entity # persistence. All code for interacting with the database lives in diff --git a/lib/inferno/repositories/in_memory_repository.rb b/lib/inferno/repositories/in_memory_repository.rb index e33885c7b..0d29459d3 100644 --- a/lib/inferno/repositories/in_memory_repository.rb +++ b/lib/inferno/repositories/in_memory_repository.rb @@ -1,3 +1,5 @@ +require 'forwardable' + module Inferno module Repositories class InMemoryRepository diff --git a/lib/inferno/repositories/validate_runnable_reference.rb b/lib/inferno/repositories/validate_runnable_reference.rb index 14e278a14..4f92ac1d9 100644 --- a/lib/inferno/repositories/validate_runnable_reference.rb +++ b/lib/inferno/repositories/validate_runnable_reference.rb @@ -18,7 +18,7 @@ def check_runnable_reference reference_exists = runnable_reference_exists?(runnable_type, id) return if reference_exists - { key: runnable_type, message: "of #{id} is not valid" } + { key: runnable_type, message: "of #{id} does not exist" } else { key: :base, message: "must contain exactly one of 'test_id', 'test_group_id', or 'test_suite_id'" } end diff --git a/lib/inferno/spec_support.rb b/lib/inferno/spec_support.rb new file mode 100644 index 000000000..85725c78a --- /dev/null +++ b/lib/inferno/spec_support.rb @@ -0,0 +1,9 @@ +module Inferno + # @api private + # This module provides constants so that unit tests in suite repositories can + # load the factories defined in inferno. + module SpecSupport + FACTORY_BOT_SUPPORT_PATH = File.expand_path('../../spec/support/factory_bot', __dir__).freeze + FACTORY_PATH = File.expand_path('../../spec/factories', __dir__).freeze + end +end diff --git a/lib/inferno/utils/middleware/request_logger.rb b/lib/inferno/utils/middleware/request_logger.rb index 474d3b2c2..465dfdd25 100644 --- a/lib/inferno/utils/middleware/request_logger.rb +++ b/lib/inferno/utils/middleware/request_logger.rb @@ -1,5 +1,3 @@ -require 'pry' - module Inferno module Utils # @api private diff --git a/lib/inferno/utils/suite_tracker.rb b/lib/inferno/utils/suite_tracker.rb deleted file mode 100644 index e65c39501..000000000 --- a/lib/inferno/utils/suite_tracker.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Inferno - module Utils - class SuiteTracker - class << self - def classes_defined_at_path - @classes_defined_at_path ||= Hash.new { |hash, key| hash[key] = Set.new } - end - end - end - end -end diff --git a/lib/inferno/version.rb b/lib/inferno/version.rb new file mode 100644 index 000000000..69acce90e --- /dev/null +++ b/lib/inferno/version.rb @@ -0,0 +1,3 @@ +module Inferno + VERSION = '0.0.1'.freeze +end diff --git a/package-lock.json b/package-lock.json index 3ef495db1..c9c86b6ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10848,12 +10848,6 @@ "set-value": "^2.0.1" } }, - "uniq": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", - "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", - "dev": true - }, "unist-builder": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-2.0.3.tgz", diff --git a/spec/factories/test_session.rb b/spec/factories/test_session.rb index 5af1090d5..617d5a4c3 100644 --- a/spec/factories/test_session.rb +++ b/spec/factories/test_session.rb @@ -1,3 +1,5 @@ +require_relative '../../lib/inferno/repositories' + FactoryBot.define do factory :test_session, class: 'Inferno::Entities::TestSession' do test_suite_id { 'BasicTestSuite::Suite' } diff --git a/spec/fixtures/basic_test_suite.rb b/spec/fixtures/basic_test_suite.rb index e2aebda3b..faed23bbd 100644 --- a/spec/fixtures/basic_test_suite.rb +++ b/spec/fixtures/basic_test_suite.rb @@ -1,3 +1,5 @@ +require_relative 'basic_test_group' + module BasicTestSuite class Suite < Inferno::Entities::TestSuite title 'Basic Test Suite' diff --git a/spec/inferno/repositories/requests_spec.rb b/spec/inferno/repositories/requests_spec.rb index b3f3db7f5..78a12650a 100644 --- a/spec/inferno/repositories/requests_spec.rb +++ b/spec/inferno/repositories/requests_spec.rb @@ -1,3 +1,5 @@ +require_relative '../../../lib/inferno/repositories/requests' + RSpec.describe Inferno::Repositories::Requests do let(:repo) { described_class.new } let(:test_run) { repo_create(:test_run) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bea306cb8..ef07565cf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,10 +3,13 @@ ENV['APP_ENV'] ||= 'test' +require 'database_cleaner/sequel' + require 'simplecov' SimpleCov.start do enable_coverage :branch add_filter '/spec/' + add_filter '/lib/inferno/db/migrations' end if ENV['GITHUB_ACTIONS'] @@ -127,16 +130,14 @@ end end +require_relative '../lib/inferno' +Inferno::Application.finalize! + require_relative 'support/factory_bot' RSpec::Matchers.define_negated_matcher :exclude, :include -require_relative '../config/application' -Inferno::Application.finalize! - FHIR.logger = Inferno::Application['logger'] DatabaseCleaner[:sequel].strategy = :truncation DatabaseCleaner[:sequel].db = Inferno::Application['db.connection'] - -require_relative './fixtures/basic_test_suite' diff --git a/spec/suites/covid19_vci/file_download_spec.rb b/spec/suites/covid19_vci/file_download_spec.rb deleted file mode 100644 index d65f6c3a5..000000000 --- a/spec/suites/covid19_vci/file_download_spec.rb +++ /dev/null @@ -1,289 +0,0 @@ -RSpec.describe Covid19VCI::FileDownload do - let(:suite) { Inferno::Repositories::TestSuites.new.find('c19-vci') } - let(:runner) { Inferno::TestRunner.new(test_session: test_session, test_run: test_run) } - let(:test_session) do - Inferno::Repositories::TestSessions.new.create(test_suite_id: suite.id) - end - let(:request_repo) { Inferno::Repositories::Requests.new } - let(:group) { suite.groups.first } - - def run(runnable, inputs = {}) - test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) - test_run = Inferno::Repositories::TestRuns.new.create(test_run_params) - Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable, inputs) - Inferno::Repositories::TestRuns.new.results_for_test_run(test_run.id) - end - - describe 'vci-file-01' do - let(:test) { group.tests.first } - let(:url) { 'http://example.com/hc' } - - it 'passes if valid json is downloaded' do - stubbed_request = - stub_request(:get, url) - .to_return(status: 200, body: { abc: 'def' }.to_json) - - result = run(test, { file_download_url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('pass') - end - - it 'fails if a non-200 status code is received' do - stubbed_request = - stub_request(:get, url) - .to_return(status: 500, body: { abc: 'def' }.to_json) - - result = run(test, { file_download_url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/200/) - end - - it 'fails if a non-JSON payload is received' do - stubbed_request = - stub_request(:get, url) - .to_return(status: 200, body: 'def') - - result = run(test, { file_download_url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/JSON/) - end - end - - describe 'vci-file-02' do - let(:test) { group.tests[1] } - - it 'passes if the response has the correct Content-Type header' do - request_repo.create( - status: 200, - response_headers: [{ name: 'content-type', value: 'application/smart-health-card' }], - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'errors if the vci_file_download request has not been made' do - result = run(test).first - - expect(result.result).to eq('error') - expect(result.result_message).to match(/vci_file_download/) - end - - it 'skips if a non-200 response was received' do - request_repo.create( - status: 500, - name: :vci_file_download, - test_session_id: test_session.id - ) - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the response has an incorrect Content-Type header' do - request_repo.create( - status: 200, - response_headers: [{ name: 'content-type', value: 'application/json' }], - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Content-Type/) - end - - it 'fails if the response has no Content-Type header' do - request_repo.create( - status: 200, - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/did not include/) - end - end - - describe 'vci-file-03' do - let(:test) { group.tests[2] } - - it 'passes if the download url ends in .smart-health-card' do - request_repo.create( - status: 200, - url: 'http://example.com/hc.smart-health-card', - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'errors if the vci_file_download request has not been made' do - result = run(test).first - - expect(result.result).to eq('error') - expect(result.result_message).to match(/vci_file_download/) - end - - it 'skips if a non-200 response was received' do - request_repo.create( - status: 500, - name: :vci_file_download, - test_session_id: test_session.id - ) - result = run(test).first - - expect(result.result).to eq('skip') - end - - context 'with a url that does not end in .smart-health-card' do - let(:url) { 'http://example.com/hc' } - - it 'passes if the response contains a Content-Disposition header with a .smart-health-card extension' do - request_repo.create( - status: 200, - url: url, - response_headers: [{ name: 'content-disposition', value: 'attachment; filename="hc.smart-health-card"' }], - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'fails if no Content-Disposition header is received' do - request_repo.create( - status: 200, - url: url, - name: :vci_file_download, - test_session_id: test_session.id - ) - result = run(test).first - - expect(result.result).to eq('fail') - end - - it 'fails if Content-Disposition header does not indicate the file should be downloaded' do - request_repo.create( - status: 200, - url: url, - response_headers: [{ name: 'content-disposition', value: 'inline' }], - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/should be downloaded/) - end - - it 'fails if Content-Disposition header does not indicate a .smart-health-card extension' do - request_repo.create( - status: 200, - url: url, - response_headers: [{ name: 'content-disposition', value: 'attachment; filename="hc.health-card"' }], - name: :vci_file_download, - test_session_id: test_session.id - ) - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/extension/) - end - end - end - - describe 'vci-file-04' do - let(:test) { group.tests[3] } - - it 'passes if the response contains an array of VC strings' do - request_repo.create( - status: 200, - response_body: { 'verifiableCredential' => ['abc'] }.to_json, - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'errors if the vci_file_download request has not been made' do - result = run(test).first - - expect(result.result).to eq('error') - expect(result.result_message).to match(/vci_file_download/) - end - - it 'skips if a non-200 response was received' do - request_repo.create( - status: 500, - name: :vci_file_download, - test_session_id: test_session.id - ) - result = run(test).first - - expect(result.result).to eq('skip') - end - - it "fails if the body does not contain a 'verifiableCredential' field" do - request_repo.create( - status: 200, - response_body: {}.to_json, - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it "fails if the 'verifiableCredential' field does not contain an array" do - request_repo.create( - status: 200, - response_body: { 'verifiableCredential' => 'abc' }.to_json, - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/must contain an Array/) - end - - it "fails if the 'verifiableCredential' field contains an empty array" do - request_repo.create( - status: 200, - response_body: { 'verifiableCredential' => [] }.to_json, - name: :vci_file_download, - test_session_id: test_session.id - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/at least one/) - end - end -end diff --git a/spec/suites/ips/condition_spec.rb b/spec/suites/ips/condition_spec.rb deleted file mode 100644 index 54b50773b..000000000 --- a/spec/suites/ips/condition_spec.rb +++ /dev/null @@ -1,102 +0,0 @@ -RSpec.describe IPS::Condition do - let(:suite) { Inferno::Repositories::TestSuites.new.find('ips') } - let(:group) { suite.groups[1].groups[21] } - let(:test_session) { repo_create(:test_session, test_suite_id: 'ips') } - let(:url) { 'http://example.com/fhir' } - let(:error_outcome) { FHIR::OperationOutcome.new(issue: [{ severity: 'error' }]) } - - def run(runnable, inputs = {}) - test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) - test_run = Inferno::Repositories::TestRuns.new.create(test_run_params) - Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable, inputs) - Inferno::Repositories::TestRuns.new.results_for_test_run(test_run.id) - end - - describe 'read test' do - let(:test) { group.tests.first } - let(:condition_id) { 'abc123' } - - it 'passes if a Condition was received' do - resource = FHIR::Condition.new(id: condition_id) - stub_request(:get, "#{url}/Condition/#{condition_id}") - .to_return(status: 200, body: resource.to_json) - - result = run(test, url: url, condition_id: condition_id).first - - expect(result.result).to eq('pass') - end - - it 'fails if a 200 is not received' do - resource = FHIR::Condition.new(id: condition_id) - stub_request(:get, "#{url}/Condition/#{condition_id}") - .to_return(status: 201, body: resource.to_json) - - result = run(test, url: url, condition_id: condition_id).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/200/) - end - - it 'fails if a Condition is not received' do - resource = FHIR::Patient.new(id: condition_id) - stub_request(:get, "#{url}/Condition/#{condition_id}") - .to_return(status: 200, body: resource.to_json) - - result = run(test, url: url, condition_id: condition_id).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Condition/) - end - - it 'fails if the id received does not match the one requested' do - resource = FHIR::Condition.new(id: '456') - stub_request(:get, "#{url}/Condition/#{condition_id}") - .to_return(status: 200, body: resource.to_json) - - result = run(test, url: url, condition_id: condition_id).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/resource with id/) - end - end - - describe 'validation test' do - let(:test) { group.tests.last } - - it 'passes if the resource is valid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - resource = FHIR::Condition.new - repo_create( - :request, - name: :condition, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'fails if the resource is not valid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Condition.new - repo_create( - :request, - name: :condition, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - end - end -end diff --git a/spec/suites/ips/document_operation_spec.rb b/spec/suites/ips/document_operation_spec.rb deleted file mode 100644 index 4dcaf31bd..000000000 --- a/spec/suites/ips/document_operation_spec.rb +++ /dev/null @@ -1,482 +0,0 @@ -RSpec.describe IPS::DocumentOperation do - let(:suite) { Inferno::Repositories::TestSuites.new.find('ips') } - let(:group) { suite.groups.first.groups.first } - let(:test_session) { repo_create(:test_session, test_suite_id: 'ips') } - let(:url) { 'http://example.com/fhir' } - let(:error_outcome) { FHIR::OperationOutcome.new(issue: [{ severity: 'error' }]) } - let(:base_capability_params) do - { - fhirVersion: '4.0.1' - } - end - - def run(runnable, inputs = {}) - test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) - test_run = Inferno::Repositories::TestRuns.new.create(test_run_params) - Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable, inputs) - Inferno::Repositories::TestRuns.new.results_for_test_run(test_run.id) - end - - describe 'Capability test' do - let(:test) { group.tests.first } - - it 'passes if a CapabilityStatement which supports the document operation is received' do - resource = FHIR::CapabilityStatement.new( - base_capability_params.merge( - rest: [ - { - resource: [ - { - type: 'Composition', - operation: [{ definition: 'http://hl7.org/fhir/OperationDefinition/Composition-document' }] - } - ] - } - ] - ) - ) - stubbed_request = - stub_request(:get, "#{url}/metadata") - .to_return(status: 200, body: resource.to_json) - - result = run(test, { url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('pass') - end - - it 'fails if a non-200 status code is received' do - stubbed_request = - stub_request(:get, "#{url}/metadata") - .to_return(status: 500) - - result = run(test, { url: url }).first - - expect(stubbed_request).to have_been_made.at_least_once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/200/) - end - - describe 'Operation test' do - let(:test) { group.tests[1] } - let(:composition_id) { 'abc123' } - - it 'passes if a Bundle is received containing all resources referenced in the Composition' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - composition = FHIR::Composition.new( - id: composition_id, - section: [ - { entry: [{ reference: 'Patient/123' }] }, - { entry: [{ reference: 'Condition/456' }] } - ] - ) - bundle = FHIR::Bundle.new( - entry: [ - { resource: FHIR::Patient.new(id: '123') }, - { resource: FHIR::Condition.new(id: '456') } - ] - ) - read_request = - stub_request(:get, "#{url}/Composition/#{composition_id}") - .to_return(status: 200, body: composition.to_json) - operation_request = - stub_request(:post, "#{url}/Composition/#{composition_id}/$document") - .with(query: { persist: true }) - .to_return(status: 200, body: bundle.to_json) - - result = run(test, { url: url, composition_id: composition_id }).first - - expect(result.result).to eq('pass') - expect(read_request).to have_been_made.once - expect(operation_request).to have_been_made.once - end - - it 'fails if the Composition is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - composition = FHIR::Composition.new(id: composition_id) - read_request = - stub_request(:get, "#{url}/Composition/#{composition_id}") - .to_return(status: 200, body: composition.to_json) - - result = run(test, { url: url, composition_id: composition_id }).first - - expect(result.result).to eq('fail') - expect(read_request).to have_been_made.once - expect(result.result_message).to match(/Resource does not conform/) - end - - it 'fails if the Bundle does not contain all resources referenced in the Composition' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - composition = FHIR::Composition.new( - id: composition_id, - section: [ - { entry: [{ reference: 'Patient/123' }] }, - { entry: [{ reference: 'Condition/456' }] } - ] - ) - bundle = FHIR::Bundle.new( - entry: [ - { resource: FHIR::Patient.new(id: '123') } - ] - ) - read_request = - stub_request(:get, "#{url}/Composition/#{composition_id}") - .to_return(status: 200, body: composition.to_json) - operation_request = - stub_request(:post, "#{url}/Composition/#{composition_id}/$document") - .with(query: { persist: true }) - .to_return(status: 200, body: bundle.to_json) - - result = run(test, { url: url, composition_id: composition_id }).first - - expect(result.result).to eq('fail') - expect(read_request).to have_been_made.once - expect(operation_request).to have_been_made.once - expect(result.result_message).to match(%r{resources were missing.*Condition/456}) - end - end - end - - describe 'Bundle test' do - let(:test) { group.tests[2] } - - it 'passes if a valid Bundle was received' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - resource = FHIR::Bundle.new - - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the Bundle is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Resource does not conform/) - end - end - - describe 'Composition test' do - let(:test) { group.tests[3] } - - it 'passes if the first Bundle entry is a valid Composition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the first Bundle entry is not a valid Composition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }, { resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/first entry/) - end - - it 'fails if the Composition is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Resource does not conform/) - end - end - - describe 'MedicationStatement test' do - let(:test) { group.tests[4] } - - it 'passes if the Bundle contains a valid MedicationStatement' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::MedicationStatement.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the Bundle does not contain a MedicationStatement' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the MedicationStatement is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::MedicationStatement.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end - - describe 'AllergyIntolerance test' do - let(:test) { group.tests[5] } - - it 'passes if the Bundle contains a valid AllergyIntolerance' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::AllergyIntolerance.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the Bundle does not contain a AllergyIntolerance' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the AllergyIntolerance is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::AllergyIntolerance.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end - - describe 'Condition test' do - let(:test) { group.tests[6] } - - it 'passes if the Bundle contains a valid Condition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Condition.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the Bundle does not contain a Condition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the Condition is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Condition.new }]) - repo_create( - :request, - name: :document_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end -end diff --git a/spec/suites/ips/summary_operation_spec.rb b/spec/suites/ips/summary_operation_spec.rb deleted file mode 100644 index 3c4b588c3..000000000 --- a/spec/suites/ips/summary_operation_spec.rb +++ /dev/null @@ -1,416 +0,0 @@ -RSpec.describe IPS::SummaryOperation do - let(:suite) { Inferno::Repositories::TestSuites.new.find('ips') } - let(:group) { suite.groups.first.groups.last } - let(:test_session) { repo_create(:test_session, test_suite_id: 'ips') } - let(:url) { 'http://example.com/fhir' } - let(:error_outcome) { FHIR::OperationOutcome.new(issue: [{ severity: 'error' }]) } - let(:base_capability_params) do - { - fhirVersion: '4.0.1' - } - end - - def run(runnable, inputs = {}) - test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) - test_run = Inferno::Repositories::TestRuns.new.create(test_run_params) - Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable, inputs) - Inferno::Repositories::TestRuns.new.results_for_test_run(test_run.id) - end - - describe 'Capability test' do - let(:test) { group.tests.first } - - it 'passes if a CapabilityStatement which supports the summary operation is received' do - resource = FHIR::CapabilityStatement.new( - base_capability_params.merge( - rest: [ - { - resource: [ - { - type: 'Composition', - operation: [{ definition: 'http://hl7.org/fhir/OperationDefinition/Patient-summary' }] - } - ] - } - ] - ) - ) - stubbed_request = - stub_request(:get, "#{url}/metadata") - .to_return(status: 200, body: resource.to_json) - - result = run(test, { url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('pass') - end - - it 'fails if a non-200 status code is received' do - stubbed_request = - stub_request(:get, "#{url}/metadata") - .to_return(status: 500) - - result = run(test, { url: url }).first - - expect(stubbed_request).to have_been_made.at_least_once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/200/) - end - - it 'fails if the CapabilityStatement does not support the summary operation' do - resource = FHIR::CapabilityStatement.new(base_capability_params) - stubbed_request = - stub_request(:get, "#{url}/metadata") - .to_return(status: 200, body: resource.to_json) - - result = run(test, { url: url }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/\$summary/) - end - end - - describe 'Bundle test' do - let(:test) { group.tests[1] } - let(:patient_id) { 'abc123' } - - it 'passes if the $summary operation returns a valid Bundle' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - resource = FHIR::Bundle.new - stubbed_request = - stub_request(:post, "#{url}/Patient/#{patient_id}/$summary") - .to_return(status: 200, body: resource.to_json) - - result = run(test, { url: url, patient_id: patient_id }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('pass') - end - - it 'fails if a 200 is not received' do - resource = FHIR::Bundle.new - stubbed_request = - stub_request(:post, "#{url}/Patient/#{patient_id}/$summary") - .to_return(status: 201, body: resource.to_json) - - result = run(test, { url: url, patient_id: patient_id }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/200/) - end - - it 'fails if a Bundle is not received' do - stubbed_request = - stub_request(:post, "#{url}/Patient/#{patient_id}/$summary") - .to_return(status: 200, body: FHIR::Patient.new.to_json) - - result = run(test, { url: url, patient_id: patient_id }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Bundle/) - end - - it 'fails if a Bundle is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new - stubbed_request = - stub_request(:post, "#{url}/Patient/#{patient_id}/$summary") - .to_return(status: 200, body: resource.to_json) - - result = run(test, { url: url, patient_id: patient_id }).first - - expect(stubbed_request).to have_been_made.once - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Resource does not conform/) - end - end - - describe 'Composition test' do - let(:test) { group.tests[2] } - - it 'passes if the first Bundle entry is a valid Composition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'fails if the first Bundle entry is not a valid Composition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }, { resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/first entry/) - end - - it 'fails if the Composition is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Composition.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/Resource does not conform/) - end - end - - describe 'MedicationStatement test' do - let(:test) { group.tests[3] } - - it 'passes if the first Bundle entry is a valid MedicationStatement' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::MedicationStatement.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'passes if the Bundle does not contain a MedicationStatement' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the MedicationStatement is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::MedicationStatement.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end - - describe 'AllergyIntolerance test' do - let(:test) { group.tests[4] } - - it 'passes if the first Bundle entry is a valid AllergyIntolerance' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::AllergyIntolerance.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'passes if the Bundle does not contain a AllergyIntolerance' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the AllergyIntolerance is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::AllergyIntolerance.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end - - describe 'Condition test' do - let(:test) { group.tests[5] } - - it 'passes if the first Bundle entry is a valid Condition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Condition.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json) - - result = run(test).first - - expect(result.result).to eq('pass') - end - - it 'skips if a Bundle has not been received' do - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: FHIR::Patient.new.to_json - ) - - result = run(test).first - - expect(result.result).to eq('skip') - end - - it 'passes if the Bundle does not contain a Condition' do - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Patient.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/does not contain/) - end - - it 'fails if the Condition is invalid' do - stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate") - .with(query: hash_including({})) - .to_return(status: 200, body: error_outcome.to_json) - - resource = FHIR::Bundle.new(entry: [{ resource: FHIR::Condition.new }]) - repo_create( - :request, - name: :summary_operation, - test_session_id: test_session.id, - response_body: resource.to_json - ) - - result = run(test).first - - expect(result.result).to eq('fail') - expect(result.result_message).to match(/bundle entries are invalid/) - end - end -end diff --git a/suites/covid19_vci/fhir_operation.rb b/suites/covid19_vci/fhir_operation.rb deleted file mode 100644 index 424d6a30d..000000000 --- a/suites/covid19_vci/fhir_operation.rb +++ /dev/null @@ -1,96 +0,0 @@ -module Covid19VCI - class FHIROperation < Inferno::TestGroup - id 'vci_fhir_operation' - title 'Download and validate a health card via FHIR $health-cards-issue operation' - - input :base_fhir_url, :patient_id - - fhir_client do - url :base_fhir_url - end - - test do - title 'Server advertises health card support in its SMART configuration' - id 'vci-fhir-01' - - run do - get("#{base_fhir_url}/.well-known/smart-configuration") - - assert_response_status(200) - assert_valid_json(response[:body]) - - smart_configuration = JSON.parse(response[:body]) - - assert smart_configuration['capabilities']&.include?('health-cards'), - "SMART configuration does not list support for 'health-cards' capability" - end - end - - test do - title 'Server advertises $health-cards-issue operation support in its CapabilityStatement' - id 'vci-fhir-02' - - run do - fhir_get_capability_statement - - assert_response_status(200) - - operations = resource.rest&.flat_map do |rest| - rest.resource - &.select { |r| r.type == 'Patient' && r.respond_to?(:operation) } - &.flat_map(&:operation) - end&.compact - - operation_defined = operations.any? { |operation| operation.name == 'health-cards-issue' } - - assert operation_defined, - 'Server CapabilityStatement did not declare support for $health-cards-issue operation ' \ - 'on the Patient resource.' - end - end - - test do - title 'Server returns a health card from the $health-cards-issue operation' - id 'vci-fhir-03' - output :credential_strings - - run do - request_params = FHIR::Parameters.new( - parameter: [ - { - name: 'credentialType', - valueUri: 'https://smarthealth.cards#covid19' - } - ] - ) - fhir_operation("/Patient/#{patient_id}/$health-cards-issue", body: request_params) - - assert_response_status((200..207).to_a) - assert_resource_type(:parameters) - - hc_parameters = resource.parameter.select { |parameter| parameter.name == 'verifiableCredential' } - - assert hc_parameters.present?, 'No COVID-19 health cards were returned' - credential_strings = hc_parameters.map(&:value).join(',') - - output credential_strings: credential_strings - - count = hc_parameters.length - - pass "#{count} verifiable #{'credential'.pluralize(count)} received" - end - end - - test from: :vc_headers do - id 'vci-fhir-04' - end - - test from: :vc_signature_verification do - id 'vci-fhir-05' - end - - test from: :vc_payload_verification do - id 'vci-fhir-06' - end - end -end diff --git a/suites/covid19_vci/file_download.rb b/suites/covid19_vci/file_download.rb deleted file mode 100644 index 6fe25caf0..000000000 --- a/suites/covid19_vci/file_download.rb +++ /dev/null @@ -1,100 +0,0 @@ -module Covid19VCI - class FileDownload < Inferno::TestGroup - id 'vci_file_download' - title 'Download and validate a health card via file download' - - input :file_download_url - - test do - id 'vci-file-01' - title 'Health card can be downloaded' - description 'The health card can be downloaded and is a valid JSON object' - makes_request :vci_file_download - - run do - get(file_download_url, name: :vci_file_download) - - assert_response_status(200) - assert_valid_json(response[:body]) - end - end - - test do - id 'vci-file-02' - title 'Response contains correct Content-Type of application/smart-health-card' - uses_request :vci_file_download - - run do - skip_if request.status != 200, 'Health card not successfully downloaded' - - content_type = request.response_header('Content-Type') - - assert content_type.present?, 'Response did not include a Content-Type header' - assert content_type.value.match?(%r{\Aapplication/smart-health-card(\z|\W)}), - "Content-Type header was '#{content_type.value}' instead of 'application/smart-health-card'" - end - end - - test do - id 'vci-file-03' - title 'Health card is provided as a file download with a .smart-health-card extension' - uses_request :vci_file_download - - run do - skip_if request.status != 200, 'Health card not successfully downloaded' - - pass_if request.url.ends_with?('.smart-health-card') - - content_disposition = request.response_header('Content-Disposition') - assert content_disposition.present?, - "Url did not end with '.smart-health-card' and response did not include a Content-Disposition header" - - attachment_pattern = /\Aattachment;/ - assert content_disposition.value.match?(attachment_pattern), - "Url did not end with '.smart-health-card' and " \ - "Content-Disposition header does not indicate file should be downloaded: '#{content_disposition}'" - - extension_pattern = /filename=".*\.smart-health-card"/ - assert content_disposition.value.match?(extension_pattern), - "Url did not end with '.smart-health-card' and Content-Disposition header does not indicate " \ - "file should have a '.smart-health-card' extension: '#{content_disposition}'" - end - end - - test do - id 'vci-file-04' - title 'Response contains an array of Verifiable Credential strings' - uses_request :vci_file_download - output :credential_strings - - run do - skip_if request.status != 200, 'Health card not successfully downloaded' - - body = JSON.parse(response[:body]) - assert body.include?('verifiableCredential'), - "Health card does not contain 'verifiableCredential' field" - - vc = body['verifiableCredential'] - - assert vc.is_a?(Array), "'verifiableCredential' field must contain an Array" - assert vc.length.positive?, "'verifiableCredential' field must contain at least one verifiable credential" - - output credential_strings: vc.join(',') - - pass "Received #{vc.length} verifiable #{'credential'.pluralize(vc.length)}" - end - end - - test from: :vc_headers do - id 'vci-file-05' - end - - test from: :vc_signature_verification do - id 'vci-file-06' - end - - test from: :vc_payload_verification do - id 'vci-file-07' - end - end -end diff --git a/suites/covid19_vci/suite.rb b/suites/covid19_vci/suite.rb deleted file mode 100644 index 5084f517b..000000000 --- a/suites/covid19_vci/suite.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'health_cards' - -module Covid19VCI - class Suite < Inferno::TestSuite - id 'c19-vci' - title 'SMART Health Cards: Vaccination & Testing' - - group from: :vci_file_download - group from: :vci_fhir_operation - end -end diff --git a/suites/covid19_vci/vc_headers.rb b/suites/covid19_vci/vc_headers.rb deleted file mode 100644 index 9fb6647e0..000000000 --- a/suites/covid19_vci/vc_headers.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Covid19VCI - class VCHeaders < Inferno::Test - title 'Health Cards contain the correct headers' - input :credential_strings - - id :vc_headers - - run do - skip_if credential_strings.blank?, 'No Verifiable Credentials received' - credential_strings.split(',').each do |credential| - header = HealthCards::JWS.from_jws(credential).header - - assert header['zip'] == 'DEF', "Expected 'zip' header to equal 'DEF', but found '#{header['zip']}'" - assert header['alg'] == 'ES256', "Expected 'alg' header to equal 'ES256', but found '#{header['alg']}'" - assert header['kid'].present?, "No 'kid' header was present" - rescue StandardError => e - assert false, "Error decoding credential: #{e.message}" - end - end - end -end diff --git a/suites/covid19_vci/vc_payload_verification.rb b/suites/covid19_vci/vc_payload_verification.rb deleted file mode 100644 index ada7c90b9..000000000 --- a/suites/covid19_vci/vc_payload_verification.rb +++ /dev/null @@ -1,115 +0,0 @@ -module Covid19VCI - class VCPayloadVerification < Inferno::Test - title 'Health Card payloads follow the spec requirements' - input :credential_strings - - id :vc_payload_verification - - run do - skip_if credential_strings.blank?, 'No Verifiable Credentials received' - - credential_strings.split(',').each do |credential| - raw_payload = HealthCards::JWS.from_jws(credential).payload - assert raw_payload&.length&.positive?, 'No payload found' - - decompressed_payload = - begin - Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(raw_payload) - rescue Zlib::DataError - assert false, 'Payload compression error. Unable to inflate payload.' - end - - assert decompressed_payload.length.positive?, 'Payload compression error. Unable to inflate payload.' - - payload_length = decompressed_payload.length - health_card = HealthCards::HealthCard.from_jws(credential) - health_card_length = health_card.to_json.length - - warning do - assert payload_length <= health_card_length, - "Payload may not be properly minified. Received a payload with length #{payload_length}, " \ - "but was able to generate a payload with length #{health_card_length}" - end - - assert_valid_json decompressed_payload, 'Payload is not valid JSON' - - payload = JSON.parse(decompressed_payload) - - warning do - nbf = payload['nbf'] - assert nbf.present?, "Payload does not include an 'nbf' claim" - assert nbf.is_a?(Numeric), "Expected 'nbf' claim to be Numeric, but found #{nbf.class}" - issue_time = Time.at(nbf).to_datetime - assert issue_time < DateTime.now, "'nbf' is in the future: #{issue_time.rfc822}" - end - - vc = payload['vc'] - assert vc.is_a?(Hash), "Expected 'vc' claim to be a JSON object, but found #{vc.class}" - type = vc['type'] - - warning do - assert type.is_a?(Array), "Expected 'vc.type' to be an array, but found #{type.class}" - assert type.include?('https://smarthealth.cards#health-card'), - "'vc.type' does not include 'https://smarthealth.cards#health-card'" - end - - subject = vc['credentialSubject'] - assert subject.is_a?(Hash), "Expected 'vc.credentialSubject' to be a JSON object, but found #{subject.class}" - - warning do - assert subject['fhirVersion'].present?, "'vc.credentialSubject.fhirVersion' not provided" - end - - raw_bundle = subject['fhirBundle'] - assert raw_bundle.is_a?(Hash), "Expected 'vc.fhirBundle' to be a JSON object, but found #{raw_bundle.class}" - - resource_scheme_regex = /\Aresource:\d+\z/ - warning do - urls = raw_bundle['entry'].map { |entry| entry['fullUrl'] } - bad_urls = urls.reject { |url| url.match?(resource_scheme_regex) } - assert bad_urls.empty?, - "The following Bundle entry urls do not use short resource-scheme URIs: #{bad_urls.join(', ')}" - end - - bundle = FHIR::Bundle.new(raw_bundle) - resources = bundle.entry.map(&:resource) - bundle.entry.each { |entry| entry.resource = nil } - resources << bundle - - resources.each do |resource| - warning { assert resource.id.nil?, "#{resource.resourceType} resource should not have an 'id' element" } - - if resource.respond_to? :text - warning { assert resource.text.nil?, "#{resource.resourceType} resource should not have a 'text' element" } - end - - walk_resource(resource) do |value, meta, path| - case meta['type'] - when 'CodeableConcept' - warning { assert value.text.nil?, "#{resource.resourceType} should not have a #{path}.text element" } - when 'Coding' - warning do - assert value.display.nil?, "#{resource.resourceType} should not have a #{path}.display element" - end - when 'Reference' - warning do - next if value.reference.nil? - - assert value.reference.match?(resource_scheme_regex), - "#{resource.resourceType}.#{path}.reference is not using the short resource URI scheme: " \ - "#{value.reference}" - end - when 'Meta' - hash = value.to_hash - warning do - assert hash.length == 1 && hash.include?('security'), - "If present, Bundle 'meta' field should only include 'security', " \ - "but found: #{hash.keys.join(', ')}" - end - end - end - end - end - end - end -end diff --git a/suites/covid19_vci/vc_signature_verification.rb b/suites/covid19_vci/vc_signature_verification.rb deleted file mode 100644 index dd19f9c82..000000000 --- a/suites/covid19_vci/vc_signature_verification.rb +++ /dev/null @@ -1,69 +0,0 @@ -module Covid19VCI - class VCSignatureVerification < Inferno::Test - title 'Verifiable Credential signatures can be verified' - input :credential_strings - - id :vc_signature_verification - - run do - skip_if credential_strings.blank?, 'No Verifiable Credentials received' - credential_strings.split(',').each do |credential| - card = HealthCards::HealthCard.from_jws(credential) - iss = card.issuer - - jws = HealthCards::JWS.from_jws(credential) - - assert iss.present?, 'Credential contains no `iss`' - warning { assert iss.start_with?('https://'), "`iss` SHALL use the `https` scheme: #{iss}" } - assert !iss.end_with?('/'), "`iss` SHALL NOT include a trailing `/`: #{iss}" - - key_set_url = "#{card.issuer}/.well-known/jwks.json" - - get(key_set_url) - - assert_response_status(200) - assert_valid_json(response[:body]) - - cors_header = request.response_header('Control-Allow-Origin') - warning do - assert cors_header.present?, - 'No CORS header received. Issuers SHALL publish their public keys with CORS enabled' - assert cors_header.value == '*', - "Expected CORS header value of `*`, but actual value was `#{cors_header.value}`" - end - - key_set = JSON.parse(response[:body]) - - public_key = key_set['keys'].find { |key| key['kid'] == jws.kid } - key_object = HealthCards::Key.from_jwk(public_key) - - assert public_key.present?, "Key set did not contain a key with a `kid` of #{jws.kid}" - - warning { assert public_key['kty'] == 'EC', "Key had a `kty` value of `#{public_key['kty']}` instead of `EC`" } - warning do - assert public_key['use'] == 'sig', "Key had a `use` value of `#{public_key['use']}` instead of `sig`" - end - warning do - assert public_key['alg'] == 'ES256', "Key had an `alg` value of `#{public_key['alg']}` instead of `ES256`" - end - warning do - assert public_key['crv'] == 'P-256', "Key had a `crv` value of `#{public_key['crv']}` instead of `P-256`" - end - warning { assert !public_key.include?('d'), 'Key SHALL NOT have the private key parameter `d`' } - warning do - assert public_key['kid'] == key_object.kid, - "'kid' SHALL be equal to the base64url-encoded SHA-256 JWK Thumbprint of the key. " \ - "Received: '#{public_key['kid']}', Expected: '#{key_object.kid}'" - end - - verifier = HealthCards::Verifier.new(keys: key_object, resolve_keys: false) - - begin - assert verifier.verify(jws), 'JWS signature invalid' - rescue StandardError => e - assert false, "Error decoding credential: #{e.message}" - end - end - end - end -end diff --git a/suites/ips/allergy_intolerance.rb b/suites/ips/allergy_intolerance.rb deleted file mode 100644 index f1476d3ca..000000000 --- a/suites/ips/allergy_intolerance.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class AllergyIntolerance < Inferno::TestGroup - title 'Allergy Intolerance (IPS) Tests' - description 'Verify support for the server capabilities required by the Allergy Intolerance (IPS) profile.' - id :ips_allergy_intolerance - - test do - title 'Server returns correct AllergyIntolerance resource from the AllergyIntolerance read interaction' - description %( - This test will verify that AllergyIntolerance resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips' - - input :allergy_intolerance_id - makes_request :allergy_intolerance - - run do - fhir_read(:allergy_intolerance, allergy_intolerance_id, name: :allergy_intolerance) - - assert_response_status(200) - assert_resource_type(:allergy_intolerance) - assert resource.id == allergy_intolerance_id, - "Requested resource with id #{allergy_intolerance_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns AllergyIntolerance resource that matches the Allergy Intolerance (IPS) profile' - description %( - This test will validate that the AllergyIntolerance resource returned from the server matches the Allergy Intolerance (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips' - uses_request :allergy_intolerance - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips') - end - end - end -end diff --git a/suites/ips/bundle.rb b/suites/ips/bundle.rb deleted file mode 100644 index 46523678a..000000000 --- a/suites/ips/bundle.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Bundle < Inferno::TestGroup - title 'Bundle (IPS) Tests' - description 'Verify support for the server capabilities required by the Bundle (IPS) profile.' - id :ips_bundle - - test do - title 'Server returns correct Bundle resource from the Bundle read interaction' - description %( - This test will verify that Bundle resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips' - - input :bundle_id - makes_request :bundle - - run do - fhir_read(:bundle, bundle_id, name: :bundle) - - assert_response_status(200) - assert_resource_type(:bundle) - assert resource.id == bundle_id, - "Requested resource with id #{bundle_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Bundle resource that matches the Bundle (IPS) profile' - description %( - This test will validate that the Bundle resource returned from the server matches the Bundle (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips' - uses_request :bundle - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips') - end - end - end -end diff --git a/suites/ips/composition.rb b/suites/ips/composition.rb deleted file mode 100644 index b3f3f853a..000000000 --- a/suites/ips/composition.rb +++ /dev/null @@ -1,82 +0,0 @@ -module IPS - class Composition < Inferno::TestGroup - title 'Composition (IPS) Tests' - description 'Verify support for the server capabilities required by the Composition (IPS) profile.' - id :ips_composition - - test do - title 'Server returns correct Composition resource from the Composition read interaction' - description %( - This test will verify that Composition resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips' - - input :composition_id - makes_request :composition - - run do - fhir_read(:composition, composition_id, name: :composition) - - assert_response_status(200) - assert_resource_type(:composition) - assert resource.id == composition_id, - "Requested resource with id #{composition_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Composition resource that matches the Composition (IPS) profile' - description %( - This test will validate that the Composition resource returned from the server matches the Composition (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips' - uses_request :composition - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips') - end - end - - test do - title 'Server returns a fully bundled document from a Composition resource' - description %( - This test will perform the $document operation on the chosen composition resource with the persist option on. - It will verify that all referenced resources in the composition are in the document bundle and that we are able to retrieve the bundle after it's generated. - ) - # link 'https://www.hl7.org/fhir/composition-operation-document.html' - uses_request :composition - - run do - skip_if resource.blank?, 'No resource found from Read test' - composition = resource - references_in_composition = [] - walk_resource(composition) do |value, meta, _path| - next if meta['type'] != 'Reference' - next if value.reference.blank? - - references_in_composition << value - end - - fhir_client.get("Composition/#{resource.id}/$document?persist=true") - assert_response_status(200) - assert_resource_type(:bundle) - - bundled_resources = resource.entry.map(&:resource) - missing_resources = - references_in_composition - .select(&:relative?) - .select do |reference| - resource_class = reference.resource_class - resource_id = reference.reference.split('/').last - bundled_resources.none? do |resource| - resource.instance_of?(resource_class) && resource.id == resource_id - end - end - - assert missing_resources.empty?, - 'The following resources were missing in the response from the document' \ - "operation: #{missing_resources.map(&:to_s).join(',')}" - end - end - end -end diff --git a/suites/ips/condition.rb b/suites/ips/condition.rb deleted file mode 100644 index 6d34fcf0e..000000000 --- a/suites/ips/condition.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Condition < Inferno::TestGroup - title 'Condition (IPS) Tests' - description 'Verify support for the server capabilities required by the Condition (IPS) profile.' - id :ips_condition - - test do - title 'Server returns correct Condition resource from the Condition read interaction' - description %( - This test will verify that Condition resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips' - - input :condition_id - makes_request :condition - - run do - fhir_read(:condition, condition_id, name: :condition) - - assert_response_status(200) - assert_resource_type(:condition) - assert resource.id == condition_id, - "Requested resource with id #{condition_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Condition resource that matches the Condition (IPS) profile' - description %( - This test will validate that the Condition resource returned from the server matches the Condition (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips' - uses_request :condition - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips') - end - end - end -end diff --git a/suites/ips/device.rb b/suites/ips/device.rb deleted file mode 100644 index c0a93ec97..000000000 --- a/suites/ips/device.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Device < Inferno::TestGroup - title 'Device (IPS) Tests' - description 'Verify support for the server capabilities required by the Device (IPS) profile.' - id :ips_device - - test do - title 'Server returns correct Device resource from the Device read interaction' - description %( - This test will verify that Device resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-uv-ips' - - input :device_id - makes_request :device - - run do - fhir_read(:device, device_id, name: :device) - - assert_response_status(200) - assert_resource_type(:device) - assert resource.id == device_id, - "Requested resource with id #{device_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Device resource that matches the Device (IPS) profile' - description %( - This test will validate that the Device resource returned from the server matches the Device (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-uv-ips' - uses_request :device - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-uv-ips') - end - end - end -end diff --git a/suites/ips/device_observer.rb b/suites/ips/device_observer.rb deleted file mode 100644 index 5c74d15ad..000000000 --- a/suites/ips/device_observer.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class DeviceObserver < Inferno::TestGroup - title 'Device (performer, observer) Tests' - description 'Verify support for the server capabilities required by the Device (performer, observer) profile.' - id :ips_device_observer - - test do - title 'Server returns correct Device resource from the Device read interaction' - description %( - This test will verify that Device resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-observer-uv-ips' - - input :device_id - makes_request :device_observer - - run do - fhir_read(:device, device_id, name: :device_observer) - - assert_response_status(200) - assert_resource_type(:device) - assert resource.id == device_id, - "Requested resource with id #{device_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Device resource that matches the Device (performer, observer) profile' - description %( - This test will validate that the Device resource returned from the server matches the Device (performer, observer) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-observer-uv-ips' - uses_request :device_observer - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Device-observer-uv-ips') - end - end - end -end diff --git a/suites/ips/device_use_statement.rb b/suites/ips/device_use_statement.rb deleted file mode 100644 index 252f09773..000000000 --- a/suites/ips/device_use_statement.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class DeviceUseStatement < Inferno::TestGroup - title 'Device Use Statement (IPS) Tests' - description 'Verify support for the server capabilities required by the Device Use Statement (IPS) profile.' - id :ips_device_use_statement - - test do - title 'Server returns correct DeviceUseStatement resource from the DeviceUseStatement read interaction' - description %( - This test will verify that DeviceUseStatement resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/DeviceUseStatement-uv-ips' - - input :device_use_statement_id - makes_request :device_use_statement - - run do - fhir_read(:device_use_statement, device_use_statement_id, name: :device_use_statement) - - assert_response_status(200) - assert_resource_type(:device_use_statement) - assert resource.id == device_use_statement_id, - "Requested resource with id #{device_use_statement_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns DeviceUseStatement resource that matches the Device Use Statement (IPS) profile' - description %( - This test will validate that the DeviceUseStatement resource returned from the server matches the Device Use Statement (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/DeviceUseStatement-uv-ips' - uses_request :device_use_statement - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/DeviceUseStatement-uv-ips') - end - end - end -end diff --git a/suites/ips/diagnostic_report.rb b/suites/ips/diagnostic_report.rb deleted file mode 100644 index 1d1c6b161..000000000 --- a/suites/ips/diagnostic_report.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class DiagnosticReport < Inferno::TestGroup - title 'DiagnosticReport (IPS) Tests' - description 'Verify support for the server capabilities required by the DiagnosticReport (IPS) profile.' - id :ips_diagnostic_report - - test do - title 'Server returns correct DiagnosticReport resource from the DiagnosticReport read interaction' - description %( - This test will verify that DiagnosticReport resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/DiagnosticReport-uv-ips' - - input :diagnostic_report_id - makes_request :diagnostic_report - - run do - fhir_read(:diagnostic_report, diagnostic_report_id, name: :diagnostic_report) - - assert_response_status(200) - assert_resource_type(:diagnostic_report) - assert resource.id == diagnostic_report_id, - "Requested resource with id #{diagnostic_report_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns DiagnosticReport resource that matches the DiagnosticReport (IPS) profile' - description %( - This test will validate that the DiagnosticReport resource returned from the server matches the DiagnosticReport (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/DiagnosticReport-uv-ips' - uses_request :diagnostic_report - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/DiagnosticReport-uv-ips') - end - end - end -end diff --git a/suites/ips/document_operation.rb b/suites/ips/document_operation.rb deleted file mode 100644 index 57bd918c2..000000000 --- a/suites/ips/document_operation.rb +++ /dev/null @@ -1,192 +0,0 @@ -module IPS - class DocumentOperation < Inferno::TestGroup - title 'Document Operation Tests' - description 'Verify support for the $document operation required by the Specimen (IPS) profile.' - id :ips_document_operation - - test do - title 'IPS Server declares support for $document operation in CapabilityStatement' - description %( - The IPS Server SHALL declare support for Composition/[id]/$document operation in its server CapabilityStatement - ) - # link 'http://build.fhir.org/composition-operation-document.html' - - run do - fhir_get_capability_statement - assert_response_status(200) - assert_resource_type(:capability_statement) - - operations = resource.rest&.flat_map do |rest| - rest.resource - &.select { |r| r.type == 'Composition' && r.respond_to?(:operation) } - &.flat_map(&:operation) - end&.compact - - operation_defined = operations.any? do |operation| - operation.definition == 'http://hl7.org/fhir/OperationDefinition/Composition-document' || - ['document', 'composition-document'].include?(operation.name.downcase) - end - - assert operation_defined, 'Server CapabilityStatement did not declare support for $document operation in Composition resource.' - end - end - - test do - title 'Server returns a fully bundled document from a Composition resource' - description %( - This test will perform the $document operation on the chosen composition resource with the persist option on. - It will verify that all referenced resources in the composition are in the document bundle and that we are able to retrieve the bundle after it's generated. - ) - # link 'https://www.hl7.org/fhir/composition-operation-document.html' - - input :composition_id - makes_request :document_operation - - run do - fhir_read(:composition, composition_id) - - assert_response_status(200) - assert_resource_type(:composition) - assert resource.id == composition_id, - "Requested resource with id #{composition_id}, received resource with id #{resource.id}" - - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips') - - composition = resource - references_in_composition = [] - walk_resource(composition) do |value, meta, _path| - next if meta['type'] != 'Reference' - next if value.reference.blank? - - references_in_composition << value - end - - fhir_operation("Composition/#{composition.id}/$document?persist=true", name: :document_operation) - assert_response_status(200) - assert_resource_type(:bundle) - - bundled_resources = resource.entry.map(&:resource) - missing_resources = - references_in_composition - .select(&:relative?) - .select do |reference| - resource_class = reference.resource_class - resource_id = reference.reference.split('/').last - bundled_resources.none? do |resource| - resource.instance_of?(resource_class) && resource.id == resource_id - end - end - - assert missing_resources.empty?, - 'The following resources were missing in the response from the document ' \ - "operation: #{missing_resources.map(&:reference).join(',')}" - end - end - - test do - title 'IPS Server returns Bundle resource for Composition/id/$document operation' - description %( - IPS Server return valid IPS Bundle resource as successful result of $document operation - - POST [base]/Composition/id/$document - ) - # link 'https://www.hl7.org/fhir/composition-operation-document.html' - uses_request :document_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips') - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS Composition entry' - description %( - IPS Server return valid IPS Composition resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Composition-uv-ips.html' - uses_request :document_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - assert resource.entry.length.positive?, 'Bundle has no entries' - - entry = resource.entry.first - - assert entry.resource.is_a?(FHIR::Composition), 'The first entry in the Bundle is not a Composition' - assert_valid_resource(resource: entry, profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips') - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS MedicationStatement entry' - description %( - IPS Server return valid IPS MedicationStatement resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-MedicationStatement-uv-ips.html' - uses_request :document_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::MedicationStatement) } - - assert resources_present, 'Bundle does not contain any MedicationStatement resources' - - assert_valid_bundle_entries( - resource_types: { - medication_statement: 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips' - } - ) - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS AllergyIntolerance entry' - description %( - IPS Server return valid IPS AllergyIntolerance resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-AllergyIntolerance-uv-ips.html' - uses_request :document_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::AllergyIntolerance) } - - assert resources_present, 'Bundle does not contain any AllergyIntolerance resources' - - assert_valid_bundle_entries( - resource_types: { - allergy_intolerance: 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips' - } - ) - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS Condition entry' - description %( - IPS Server return valid IPS Condition resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Condition-uv-ips.html' - uses_request :document_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::Condition) } - - assert resources_present, 'Bundle does not contain any Condition resources' - - assert_valid_bundle_entries( - resource_types: { - condition: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips' - } - ) - end - end - end -end diff --git a/suites/ips/imaging_study.rb b/suites/ips/imaging_study.rb deleted file mode 100644 index 25ca1e552..000000000 --- a/suites/ips/imaging_study.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ImagingStudy < Inferno::TestGroup - title 'Imaging Study (IPS) Tests' - description 'Verify support for the server capabilities required by the Imaging Study (IPS) profile.' - id :ips_imaging_study - - test do - title 'Server returns correct ImagingStudy resource from the ImagingStudy read interaction' - description %( - This test will verify that ImagingStudy resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/ImagingStudy-uv-ips' - - input :imaging_study_id - makes_request :imaging_study - - run do - fhir_read(:imaging_study, imaging_study_id, name: :imaging_study) - - assert_response_status(200) - assert_resource_type(:imaging_study) - assert resource.id == imaging_study_id, - "Requested resource with id #{imaging_study_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns ImagingStudy resource that matches the Imaging Study (IPS) profile' - description %( - This test will validate that the ImagingStudy resource returned from the server matches the Imaging Study (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/ImagingStudy-uv-ips' - uses_request :imaging_study - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/ImagingStudy-uv-ips') - end - end - end -end diff --git a/suites/ips/immunization.rb b/suites/ips/immunization.rb deleted file mode 100644 index 515de85bb..000000000 --- a/suites/ips/immunization.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Immunization < Inferno::TestGroup - title 'Immunization (IPS) Tests' - description 'Verify support for the server capabilities required by the Immunization (IPS) profile.' - id :ips_immunization - - test do - title 'Server returns correct Immunization resource from the Immunization read interaction' - description %( - This test will verify that Immunization resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips' - - input :immunization_id - makes_request :immunization - - run do - fhir_read(:immunization, immunization_id, name: :immunization) - - assert_response_status(200) - assert_resource_type(:immunization) - assert resource.id == immunization_id, - "Requested resource with id #{immunization_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Immunization resource that matches the Immunization (IPS) profile' - description %( - This test will validate that the Immunization resource returned from the server matches the Immunization (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips' - uses_request :immunization - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips') - end - end - end -end diff --git a/suites/ips/media_observation.rb b/suites/ips/media_observation.rb deleted file mode 100644 index 575353f15..000000000 --- a/suites/ips/media_observation.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class MediaObservation < Inferno::TestGroup - title 'Media observation (Results: laboratory, media) Tests' - description 'Verify support for the server capabilities required by the Media observation (Results: laboratory, media) profile.' - id :ips_media_observation - - test do - title 'Server returns correct Media resource from the Media read interaction' - description %( - This test will verify that Media resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Media-observation-uv-ips' - - input :media_id - makes_request :media - - run do - fhir_read(:media, media_id, name: :media) - - assert_response_status(200) - assert_resource_type(:media) - assert resource.id == media_id, - "Requested resource with id #{media_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Media resource that matches the Media observation (Results: laboratory, media) profile' - description %( - This test will validate that the Media resource returned from the server matches the Media observation (Results: laboratory, media) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Media-observation-uv-ips' - uses_request :media - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Media-observation-uv-ips') - end - end - end -end diff --git a/suites/ips/medication.rb b/suites/ips/medication.rb deleted file mode 100644 index 638699bf1..000000000 --- a/suites/ips/medication.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Medication < Inferno::TestGroup - title 'Medication (IPS) Tests' - description 'Verify support for the server capabilities required by the Medication (IPS) profile.' - id :ips_medication - - test do - title 'Server returns correct Medication resource from the Medication read interaction' - description %( - This test will verify that Medication resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Medication-uv-ips' - - input :medication_id - makes_request :medication - - run do - fhir_read(:medication, medication_id, name: :medication) - - assert_response_status(200) - assert_resource_type(:medication) - assert resource.id == medication_id, - "Requested resource with id #{medication_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Medication resource that matches the Medication (IPS) profile' - description %( - This test will validate that the Medication resource returned from the server matches the Medication (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Medication-uv-ips' - uses_request :medication - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Medication-uv-ips') - end - end - end -end diff --git a/suites/ips/medication_statement.rb b/suites/ips/medication_statement.rb deleted file mode 100644 index 7fe96e2a4..000000000 --- a/suites/ips/medication_statement.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class MedicationStatement < Inferno::TestGroup - title 'Medication Statement (IPS) Tests' - description 'Verify support for the server capabilities required by the Medication Statement (IPS) profile.' - id :ips_medication_statement - - input :medication_statement_id - - test do - title 'Server returns correct MedicationStatement resource from the MedicationStatement read interaction' - description %( - This test will verify that MedicationStatement resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips' - makes_request :medication_statement - - run do - fhir_read(:medication_statement, medication_statement_id, name: :medication_statement) - - assert_response_status(200) - assert_resource_type(:medication_statement) - assert resource.id == medication_statement_id, - "Requested resource with id #{medication_statement_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns MedicationStatement resource that matches the Medication Statement (IPS) profile' - description %( - This test will validate that the MedicationStatement resource returned from the server matches the Medication Statement (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips' - uses_request :medication_statement - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_alcohol_use.rb b/suites/ips/observation_alcohol_use.rb deleted file mode 100644 index e154643d7..000000000 --- a/suites/ips/observation_alcohol_use.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationAlcoholUse < Inferno::TestGroup - title 'Observation (SH: alcohol use) Tests' - description 'Verify support for the server capabilities required by the Observation (SH: alcohol use) profile.' - id :ips_observation_alcohol_use - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-alcoholuse-uv-ips' - - input :observation_alcohol_use_id - makes_request :observation_alcohol_use - - run do - fhir_read(:observation, observation_alcohol_use_id, name: :observation_alcohol_use) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_alcohol_use_id, - "Requested resource with id #{observation_alcohol_use_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation (SH: alcohol use) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation (SH: alcohol use) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-alcoholuse-uv-ips' - uses_request :observation_alcohol_use - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-alcoholuse-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_pregnancy_edd.rb b/suites/ips/observation_pregnancy_edd.rb deleted file mode 100644 index 7db6d2ade..000000000 --- a/suites/ips/observation_pregnancy_edd.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationPregnancyEDD < Inferno::TestGroup - title 'Observation (Pregnancy: EDD) Tests' - description 'Verify support for the server capabilities required by the Observation (Pregnancy: EDD) profile.' - id :ips_observation_pregnancy_edd - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-edd-uv-ips' - - input :observation_pregnancy_edd_id - makes_request :observation_pregnancy_edd - - run do - fhir_read(:observation, observation_pregnancy_edd_id, name: :observation_pregnancy_edd) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_pregnancy_edd_id, - "Requested resource with id #{observation_pregnancy_edd_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation (Pregnancy: EDD) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation (Pregnancy: EDD) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-edd-uv-ips' - uses_request :observation_pregnancy_edd - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-edd-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_pregnancy_outcome.rb b/suites/ips/observation_pregnancy_outcome.rb deleted file mode 100644 index 9a842e242..000000000 --- a/suites/ips/observation_pregnancy_outcome.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationPregnancyOutcome < Inferno::TestGroup - title 'Observation (Pregnancy: outcome) Tests' - description 'Verify support for the server capabilities required by the Observation (Pregnancy: outcome) profile.' - id :ips_observation_pregnancy_outcome - - input :observation_pregnancy_outcome_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-outcome-uv-ips' - makes_request :observation_pregnancy_outcome - - run do - fhir_read(:observation, observation_pregnancy_outcome_id, name: :observation_pregnancy_outcome) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_pregnancy_outcome_id, - "Requested resource with id #{observation_pregnancy_outcome_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation (Pregnancy: outcome) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation (Pregnancy: outcome) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-outcome-uv-ips' - uses_request :observation_pregnancy_outcome - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-outcome-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_pregnancy_status.rb b/suites/ips/observation_pregnancy_status.rb deleted file mode 100644 index e10e0b582..000000000 --- a/suites/ips/observation_pregnancy_status.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationPregnancyStatus < Inferno::TestGroup - title 'Observation (Pregnancy: status) Tests' - description 'Verify support for the server capabilities required by the Observation (Pregnancy: status) profile.' - id :ips_observation_pregnancy_status - - input :observation_pregnancy_status_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-status-uv-ips' - makes_request :observation_pregnancy_status - - run do - fhir_read(:observation, observation_pregnancy_status_id, name: :observation_pregnancy_status) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_pregnancy_status_id, - "Requested resource with id #{observation_pregnancy_status_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation (Pregnancy: status) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation (Pregnancy: status) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-status-uv-ips' - uses_request :observation_pregnancy_status - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-pregnancy-status-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_results.rb b/suites/ips/observation_results.rb deleted file mode 100644 index d9038e913..000000000 --- a/suites/ips/observation_results.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationResults < Inferno::TestGroup - title 'Observation Results (IPS) Tests' - description 'Verify support for the server capabilities required by the Observation Results (IPS) profile.' - id :ips_observation_results - - input :observation_results_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-uv-ips' - makes_request :observation - - run do - fhir_read(:observation, observation_results_id, name: :observation) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_results_id, - "Requested resource with id #{observation_results_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation Results (IPS) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation Results (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-uv-ips' - uses_request :observation - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_results_laboratory.rb b/suites/ips/observation_results_laboratory.rb deleted file mode 100644 index 104c34af1..000000000 --- a/suites/ips/observation_results_laboratory.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationResultsLaboratory < Inferno::TestGroup - title 'Observation Results: laboratory (IPS) Tests' - description 'Verify support for the server capabilities required by the Observation Results: laboratory (IPS) profile.' - id :ips_observation_results_laboratory - - input :observation_results_laboratory_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-laboratory-uv-ips' - makes_request :observation_lab - - run do - fhir_read(:observation, observation_results_laboratory_id, name: :observation_lab) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_results_laboratory_id, - "Requested resource with id #{observation_results_laboratory_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation Results: laboratory (IPS) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation Results: laboratory (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-laboratory-uv-ips' - uses_request :observation_lab - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-laboratory-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_results_pathology.rb b/suites/ips/observation_results_pathology.rb deleted file mode 100644 index 643b8ca29..000000000 --- a/suites/ips/observation_results_pathology.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationResultsPathology < Inferno::TestGroup - title 'Observation Results: pathology (IPS) Tests' - description 'Verify support for the server capabilities required by the Observation Results: pathology (IPS) profile.' - id :ips_observation_results_pathology - - input :observation_results_pathology_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-pathology-uv-ips' - makes_request :observation_pathology - - run do - fhir_read(:observation, observation_results_pathology_id, name: :observation_pathology) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_results_pathology_id, - "Requested resource with id #{observation_results_pathology_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation Results: pathology (IPS) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation Results: pathology (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-pathology-uv-ips' - uses_request :observation_pathology - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-pathology-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_results_radiology.rb b/suites/ips/observation_results_radiology.rb deleted file mode 100644 index e25363dad..000000000 --- a/suites/ips/observation_results_radiology.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationResultsRadiology < Inferno::TestGroup - title 'Observation Results: radiology (IPS) Tests' - description 'Verify support for the server capabilities required by the Observation Results: radiology (IPS) profile.' - id :ips_observation_results_radiology - - input :observation_results_radiology_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-radiology-uv-ips' - makes_request :observation_radiology - - run do - fhir_read(:observation, observation_results_radiology_id, name: :observation_radiology) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_results_radiology_id, - "Requested resource with id #{observation_results_radiology_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation Results: radiology (IPS) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation Results: radiology (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-radiology-uv-ips' - uses_request :observation_radiology - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-radiology-uv-ips') - end - end - end -end diff --git a/suites/ips/observation_tobacco_use.rb b/suites/ips/observation_tobacco_use.rb deleted file mode 100644 index e059c9fc5..000000000 --- a/suites/ips/observation_tobacco_use.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class ObservationTobaccoUse < Inferno::TestGroup - title 'Observation (SH: tobacco use) Tests' - description 'Verify support for the server capabilities required by the Observation (SH: tobacco use) profile.' - id :ips_observation_tobacco_use - - input :observation_tobacco_use_id - - test do - title 'Server returns correct Observation resource from the Observation read interaction' - description %( - This test will verify that Observation resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-tobaccouse-uv-ips' - makes_request :observation_tobacco_use - - run do - fhir_read(:observation, observation_tobacco_use_id, name: :observation_tobacco_use) - - assert_response_status(200) - assert_resource_type(:observation) - assert resource.id == observation_tobacco_use_id, - "Requested resource with id #{observation_tobacco_use_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Observation resource that matches the Observation (SH: tobacco use) profile' - description %( - This test will validate that the Observation resource returned from the server matches the Observation (SH: tobacco use) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-tobaccouse-uv-ips' - uses_request :observation_tobacco_use - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-tobaccouse-uv-ips') - end - end - end -end diff --git a/suites/ips/organization.rb b/suites/ips/organization.rb deleted file mode 100644 index c356e5a25..000000000 --- a/suites/ips/organization.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Organization < Inferno::TestGroup - title 'Organization (IPS) Tests' - description 'Verify support for the server capabilities required by the Organization (IPS) profile.' - id :ips_organization - - test do - title 'Server returns correct Organization resource from the Organization read interaction' - description %( - This test will verify that Organization resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Organization-uv-ips' - - input :organization_id - makes_request :organization - - run do - fhir_read(:organization, organization_id, name: :organization) - - assert_response_status(200) - assert_resource_type(:organization) - assert resource.id == organization_id, - "Requested resource with id #{organization_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Organization resource that matches the Organization (IPS) profile' - description %( - This test will validate that the Organization resource returned from the server matches the Organization (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Organization-uv-ips' - uses_request :organization - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Organization-uv-ips') - end - end - end -end diff --git a/suites/ips/patient.rb b/suites/ips/patient.rb deleted file mode 100644 index 58a099f78..000000000 --- a/suites/ips/patient.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Patient < Inferno::TestGroup - title 'Patient (IPS) Tests' - description 'Verify support for the server capabilities required by the Patient (IPS) profile.' - id :ips_patient - - test do - title 'Server returns correct Patient resource from the Patient read interaction' - description %( - This test will verify that Patient resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips' - - input :patient_id - makes_request :patient - - run do - fhir_read(:patient, patient_id, name: :patient) - - assert_response_status(200) - assert_resource_type(:patient) - assert resource.id == patient_id, - "Requested resource with id #{patient_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Patient resource that matches the Patient (IPS) profile' - description %( - This test will validate that the Patient resource returned from the server matches the Patient (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips' - uses_request :patient - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips') - end - end - end -end diff --git a/suites/ips/practitioner.rb b/suites/ips/practitioner.rb deleted file mode 100644 index 5aa24e9a6..000000000 --- a/suites/ips/practitioner.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Practitioner < Inferno::TestGroup - title 'Practitioner (IPS) Tests' - description 'Verify support for the server capabilities required by the Practitioner (IPS) profile.' - id :ips_practitioner - - test do - title 'Server returns correct Practitioner resource from the Practitioner read interaction' - description %( - This test will verify that Practitioner resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips' - - input :practitioner_id - makes_request :practitioner - - run do - fhir_read(:practitioner, practitioner_id, name: :practitioner) - - assert_response_status(200) - assert_resource_type(:practitioner) - assert resource.id == practitioner_id, - "Requested resource with id #{practitioner_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Practitioner resource that matches the Practitioner (IPS) profile' - description %( - This test will validate that the Practitioner resource returned from the server matches the Practitioner (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips' - uses_request :practitioner - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips') - end - end - end -end diff --git a/suites/ips/practitioner_role.rb b/suites/ips/practitioner_role.rb deleted file mode 100644 index 9872c5ce1..000000000 --- a/suites/ips/practitioner_role.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class PractitionerRole < Inferno::TestGroup - title 'PractitionerRole (IPS) Tests' - description 'Verify support for the server capabilities required by the PractitionerRole (IPS) profile.' - id :ips_practitioner_role - - test do - title 'Server returns correct PractitionerRole resource from the PractitionerRole read interaction' - description %( - This test will verify that PractitionerRole resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips' - - input :practitioner_role_id - makes_request :practitioner_role - - run do - fhir_read(:practitioner_role, practitioner_role_id, name: :practitioner_role) - - assert_response_status(200) - assert_resource_type(:practitioner_role) - assert resource.id == practitioner_role_id, - "Requested resource with id #{practitioner_role_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns PractitionerRole resource that matches the PractitionerRole (IPS) profile' - description %( - This test will validate that the PractitionerRole resource returned from the server matches the PractitionerRole (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips' - uses_request :practitioner_role - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips') - end - end - end -end diff --git a/suites/ips/procedure.rb b/suites/ips/procedure.rb deleted file mode 100644 index 3619a1131..000000000 --- a/suites/ips/procedure.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Procedure < Inferno::TestGroup - title 'Procedure (IPS) Tests' - description 'Verify support for the server capabilities required by the Procedure (IPS) profile.' - id :ips_procedure - - test do - title 'Server returns correct Procedure resource from the Procedure read interaction' - description %( - This test will verify that Procedure resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips' - - input :procedure_id - makes_request :procedure - - run do - fhir_read(:procedure, procedure_id, name: :procedure) - - assert_response_status(200) - assert_resource_type(:procedure) - assert resource.id == procedure_id, - "Requested resource with id #{procedure_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Procedure resource that matches the Procedure (IPS) profile' - description %( - This test will validate that the Procedure resource returned from the server matches the Procedure (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips' - uses_request :procedure - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips') - end - end - end -end diff --git a/suites/ips/specimen.rb b/suites/ips/specimen.rb deleted file mode 100644 index 22caf3da2..000000000 --- a/suites/ips/specimen.rb +++ /dev/null @@ -1,40 +0,0 @@ -module IPS - class Specimen < Inferno::TestGroup - title 'Specimen (IPS) Tests' - description 'Verify support for the server capabilities required by the Specimen (IPS) profile.' - id :ips_specimen - - test do - title 'Server returns correct Specimen resource from the Specimen read interaction' - description %( - This test will verify that Specimen resources can be read from the server. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips' - - input :specimen_id - makes_request :specimen - - run do - fhir_read(:specimen, specimen_id, name: :specimen) - - assert_response_status(200) - assert_resource_type(:specimen) - assert resource.id == specimen_id, - "Requested resource with id #{specimen_id}, received resource with id #{resource.id}" - end - end - - test do - title 'Server returns Specimen resource that matches the Specimen (IPS) profile' - description %( - This test will validate that the Specimen resource returned from the server matches the Specimen (IPS) profile. - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips' - uses_request :specimen - - run do - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips') - end - end - end -end diff --git a/suites/ips/suite.rb b/suites/ips/suite.rb deleted file mode 100644 index c621dfbfc..000000000 --- a/suites/ips/suite.rb +++ /dev/null @@ -1,54 +0,0 @@ -module IPS - class Suite < Inferno::TestSuite - title 'International Patient Summary (IPS)' - description 'International Patient Summary (IPS)' - - id 'ips' - - input :url - - fhir_client do - url :url - end - - group do - title 'IPS Operations' - - group from: :ips_document_operation - group from: :ips_summary_operation - end - - group do - title 'IPS Profiles' - - group from: :ips_observation_alcohol_use - group from: :ips_practitioner - group from: :ips_observation_results_radiology - group from: :ips_device - group from: :ips_observation_results_laboratory - group from: :ips_bundle - group from: :ips_observation_results - group from: :ips_allergy_intolerance - group from: :ips_practitioner_role - group from: :ips_observation_pregnancy_status - group from: :ips_medication_statement - group from: :ips_patient - group from: :ips_observation_pregnancy_edd - group from: :ips_specimen - group from: :ips_immunization - group from: :ips_device_observer - group from: :ips_composition - group from: :ips_organization - group from: :ips_imaging_study - group from: :ips_media_observation - group from: :ips_device_use_statement - group from: :ips_condition - group from: :ips_observation_tobacco_use - group from: :ips_observation_results_pathology - group from: :ips_diagnostic_report - group from: :ips_medication - group from: :ips_procedure - group from: :ips_observation_pregnancy_outcome - end - end -end diff --git a/suites/ips/summary_operation.rb b/suites/ips/summary_operation.rb deleted file mode 100644 index 09431c497..000000000 --- a/suites/ips/summary_operation.rb +++ /dev/null @@ -1,141 +0,0 @@ -module IPS - class SummaryOperation < Inferno::TestGroup - title 'Summary Operation (IPS) Tests' - description 'Verify support for the $summary operation required by the Specimen (IPS) profile.' - id :ips_summary_operation - - test do - title 'IPS Server declares support for $summary operation in CapabilityStatement' - description %( - The IPS Server SHALL declare support for Patient/[id]/$summary operation in its server CapabilityStatement - ) - # link 'http://build.fhir.org/ig/HL7/fhir-ips/index.html' - - run do - fhir_get_capability_statement - assert_response_status(200) - - operations = resource.rest&.flat_map do |rest| - rest.resource - &.select { |r| r.type == 'Composition' && r.respond_to?(:operation) } - &.flat_map(&:operation) - end&.compact - - operation_defined = operations.any? do |operation| - operation.definition == 'http://hl7.org/fhir/OperationDefinition/Patient-summary' || - ['summary', 'patient-summary'].include?(operation.name.downcase) - end - - assert operation_defined, 'Server CapabilityStatement did not declare support for $summary operation in Composition resource.' - end - end - - test do - title 'IPS Server returns Bundle resource for Patient/id/$summary operation' - description %( - IPS Server return valid IPS Bundle resource as successful result of $summary operation - - POST [base]/Patient/id/$summary - ) - # link 'http://build.fhir.org/ig/HL7/fhir-ips/index.html' - input :patient_id - makes_request :summary_operation - - run do - fhir_operation("Patient/#{patient_id}/$summary", name: :summary_operation) - assert_response_status(200) - assert_resource_type(:bundle) - assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips') - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS Composition entry' - description %( - IPS Server return valid IPS Composition resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Composition-uv-ips.html' - uses_request :summary_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - assert resource.entry.length.positive?, 'Bundle has no entries' - - entry = resource.entry.first - - assert entry.resource.is_a?(FHIR::Composition), 'The first entry in the Bundle is not a Composition' - assert_valid_resource(resource: entry, profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips') - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS MedicationStatement entry' - description %( - IPS Server return valid IPS MedicationStatement resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-MedicationStatement-uv-ips.html' - uses_request :summary_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::MedicationStatement) } - - assert resources_present, 'Bundle does not contain any MedicationStatement resources' - - assert_valid_bundle_entries( - resource_types: { - medication_statement: 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips' - } - ) - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS AllergyIntolerance entry' - description %( - IPS Server return valid IPS AllergyIntolerance resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-AllergyIntolerance-uv-ips.html' - uses_request :summary_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::AllergyIntolerance) } - - assert resources_present, 'Bundle does not contain any AllergyIntolerance resources' - - assert_valid_bundle_entries( - resource_types: { - allergy_intolerance: 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips' - } - ) - end - end - - test do - title 'IPS Server returns Bundle resource containing valid IPS Condition entry' - description %( - IPS Server return valid IPS Condition resource in the Bundle as first entry - ) - # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Condition-uv-ips.html' - uses_request :summary_operation - - run do - skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation' - - resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::Condition) } - - assert resources_present, 'Bundle does not contain any Condition resources' - - assert_valid_bundle_entries( - resource_types: { - condition: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips' - } - ) - end - end - end -end diff --git a/dev_suites/onc_program/additional_tests.rb b/ui_suites/onc_program/additional_tests.rb similarity index 85% rename from dev_suites/onc_program/additional_tests.rb rename to ui_suites/onc_program/additional_tests.rb index 604a9f5dc..5c1ef9d3e 100644 --- a/dev_suites/onc_program/additional_tests.rb +++ b/ui_suites/onc_program/additional_tests.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'additional_tests', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class AdditionalTests < Inferno::TestGroup title 'Additional Tests' diff --git a/dev_suites/onc_program/additional_tests/onc_standalone_public_launch.rb b/ui_suites/onc_program/additional_tests/onc_standalone_public_launch.rb similarity index 100% rename from dev_suites/onc_program/additional_tests/onc_standalone_public_launch.rb rename to ui_suites/onc_program/additional_tests/onc_standalone_public_launch.rb diff --git a/dev_suites/onc_program/additional_tests/onc_visual_inspection.rb b/ui_suites/onc_program/additional_tests/onc_visual_inspection.rb similarity index 100% rename from dev_suites/onc_program/additional_tests/onc_visual_inspection.rb rename to ui_suites/onc_program/additional_tests/onc_visual_inspection.rb diff --git a/dev_suites/onc_program/additional_tests/smart_invalid_aud.rb b/ui_suites/onc_program/additional_tests/smart_invalid_aud.rb similarity index 100% rename from dev_suites/onc_program/additional_tests/smart_invalid_aud.rb rename to ui_suites/onc_program/additional_tests/smart_invalid_aud.rb diff --git a/dev_suites/onc_program/additional_tests/smart_invalid_launch.rb b/ui_suites/onc_program/additional_tests/smart_invalid_launch.rb similarity index 100% rename from dev_suites/onc_program/additional_tests/smart_invalid_launch.rb rename to ui_suites/onc_program/additional_tests/smart_invalid_launch.rb diff --git a/dev_suites/onc_program/additional_tests/token_revocation.rb b/ui_suites/onc_program/additional_tests/token_revocation.rb similarity index 100% rename from dev_suites/onc_program/additional_tests/token_revocation.rb rename to ui_suites/onc_program/additional_tests/token_revocation.rb diff --git a/dev_suites/onc_program/ehr_practitioner_app.rb b/ui_suites/onc_program/ehr_practitioner_app.rb similarity index 88% rename from dev_suites/onc_program/ehr_practitioner_app.rb rename to ui_suites/onc_program/ehr_practitioner_app.rb index ba989de17..1d89db09a 100644 --- a/dev_suites/onc_program/ehr_practitioner_app.rb +++ b/ui_suites/onc_program/ehr_practitioner_app.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'ehr_practitioner_app', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class EHRPractitionerApp < Inferno::TestGroup title 'EHR Practitioner App' diff --git a/dev_suites/onc_program/ehr_practitioner_app/ehr_launch.rb b/ui_suites/onc_program/ehr_practitioner_app/ehr_launch.rb similarity index 100% rename from dev_suites/onc_program/ehr_practitioner_app/ehr_launch.rb rename to ui_suites/onc_program/ehr_practitioner_app/ehr_launch.rb diff --git a/dev_suites/onc_program/ehr_practitioner_app/ehr_openid_connect.rb b/ui_suites/onc_program/ehr_practitioner_app/ehr_openid_connect.rb similarity index 100% rename from dev_suites/onc_program/ehr_practitioner_app/ehr_openid_connect.rb rename to ui_suites/onc_program/ehr_practitioner_app/ehr_openid_connect.rb diff --git a/dev_suites/onc_program/ehr_practitioner_app/ehr_smart_discovery.rb b/ui_suites/onc_program/ehr_practitioner_app/ehr_smart_discovery.rb similarity index 100% rename from dev_suites/onc_program/ehr_practitioner_app/ehr_smart_discovery.rb rename to ui_suites/onc_program/ehr_practitioner_app/ehr_smart_discovery.rb diff --git a/dev_suites/onc_program/ehr_practitioner_app/ehr_token_refresh.rb b/ui_suites/onc_program/ehr_practitioner_app/ehr_token_refresh.rb similarity index 100% rename from dev_suites/onc_program/ehr_practitioner_app/ehr_token_refresh.rb rename to ui_suites/onc_program/ehr_practitioner_app/ehr_token_refresh.rb diff --git a/dev_suites/onc_program/multi_patient_api.rb b/ui_suites/onc_program/multi_patient_api.rb similarity index 90% rename from dev_suites/onc_program/multi_patient_api.rb rename to ui_suites/onc_program/multi_patient_api.rb index ea60a0503..60eeb708d 100644 --- a/dev_suites/onc_program/multi_patient_api.rb +++ b/ui_suites/onc_program/multi_patient_api.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'multi_patient_api', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class MultiPatientAPI < Inferno::TestGroup title 'Multi-Patient API' diff --git a/dev_suites/onc_program/multi_patient_api/bulk_data_authorization.rb b/ui_suites/onc_program/multi_patient_api/bulk_data_authorization.rb similarity index 100% rename from dev_suites/onc_program/multi_patient_api/bulk_data_authorization.rb rename to ui_suites/onc_program/multi_patient_api/bulk_data_authorization.rb diff --git a/dev_suites/onc_program/multi_patient_api/bulk_data_group_export.rb b/ui_suites/onc_program/multi_patient_api/bulk_data_group_export.rb similarity index 100% rename from dev_suites/onc_program/multi_patient_api/bulk_data_group_export.rb rename to ui_suites/onc_program/multi_patient_api/bulk_data_group_export.rb diff --git a/dev_suites/onc_program/multi_patient_api/bulk_data_group_export_validation.rb b/ui_suites/onc_program/multi_patient_api/bulk_data_group_export_validation.rb similarity index 100% rename from dev_suites/onc_program/multi_patient_api/bulk_data_group_export_validation.rb rename to ui_suites/onc_program/multi_patient_api/bulk_data_group_export_validation.rb diff --git a/dev_suites/onc_program/single_patient_api.rb b/ui_suites/onc_program/single_patient_api.rb similarity index 95% rename from dev_suites/onc_program/single_patient_api.rb rename to ui_suites/onc_program/single_patient_api.rb index a29fd2c4e..8d754da76 100644 --- a/dev_suites/onc_program/single_patient_api.rb +++ b/ui_suites/onc_program/single_patient_api.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'single_patient_api', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class SinglePatientAPI < Inferno::TestGroup title 'Single Patient API' diff --git a/dev_suites/onc_program/single_patient_api/us_core_allergy_intolerance.rb b/ui_suites/onc_program/single_patient_api/us_core_allergy_intolerance.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_allergy_intolerance.rb rename to ui_suites/onc_program/single_patient_api/us_core_allergy_intolerance.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_body_height.rb b/ui_suites/onc_program/single_patient_api/us_core_body_height.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_body_height.rb rename to ui_suites/onc_program/single_patient_api/us_core_body_height.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_body_temp.rb b/ui_suites/onc_program/single_patient_api/us_core_body_temp.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_body_temp.rb rename to ui_suites/onc_program/single_patient_api/us_core_body_temp.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_body_weight.rb b/ui_suites/onc_program/single_patient_api/us_core_body_weight.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_body_weight.rb rename to ui_suites/onc_program/single_patient_api/us_core_body_weight.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_bp.rb b/ui_suites/onc_program/single_patient_api/us_core_bp.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_bp.rb rename to ui_suites/onc_program/single_patient_api/us_core_bp.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_capability_statement.rb b/ui_suites/onc_program/single_patient_api/us_core_capability_statement.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_capability_statement.rb rename to ui_suites/onc_program/single_patient_api/us_core_capability_statement.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_care_plan.rb b/ui_suites/onc_program/single_patient_api/us_core_care_plan.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_care_plan.rb rename to ui_suites/onc_program/single_patient_api/us_core_care_plan.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_care_team.rb b/ui_suites/onc_program/single_patient_api/us_core_care_team.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_care_team.rb rename to ui_suites/onc_program/single_patient_api/us_core_care_team.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_clinical_notes.rb b/ui_suites/onc_program/single_patient_api/us_core_clinical_notes.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_clinical_notes.rb rename to ui_suites/onc_program/single_patient_api/us_core_clinical_notes.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_condition.rb b/ui_suites/onc_program/single_patient_api/us_core_condition.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_condition.rb rename to ui_suites/onc_program/single_patient_api/us_core_condition.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_data_absent_reason.rb b/ui_suites/onc_program/single_patient_api/us_core_data_absent_reason.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_data_absent_reason.rb rename to ui_suites/onc_program/single_patient_api/us_core_data_absent_reason.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_diagnostic_report_lab.rb b/ui_suites/onc_program/single_patient_api/us_core_diagnostic_report_lab.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_diagnostic_report_lab.rb rename to ui_suites/onc_program/single_patient_api/us_core_diagnostic_report_lab.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_diagnostic_report_note.rb b/ui_suites/onc_program/single_patient_api/us_core_diagnostic_report_note.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_diagnostic_report_note.rb rename to ui_suites/onc_program/single_patient_api/us_core_diagnostic_report_note.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_document_reference.rb b/ui_suites/onc_program/single_patient_api/us_core_document_reference.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_document_reference.rb rename to ui_suites/onc_program/single_patient_api/us_core_document_reference.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_encounter.rb b/ui_suites/onc_program/single_patient_api/us_core_encounter.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_encounter.rb rename to ui_suites/onc_program/single_patient_api/us_core_encounter.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_goal.rb b/ui_suites/onc_program/single_patient_api/us_core_goal.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_goal.rb rename to ui_suites/onc_program/single_patient_api/us_core_goal.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_head_circumference.rb b/ui_suites/onc_program/single_patient_api/us_core_head_circumference.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_head_circumference.rb rename to ui_suites/onc_program/single_patient_api/us_core_head_circumference.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_heart_rate.rb b/ui_suites/onc_program/single_patient_api/us_core_heart_rate.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_heart_rate.rb rename to ui_suites/onc_program/single_patient_api/us_core_heart_rate.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_immunization.rb b/ui_suites/onc_program/single_patient_api/us_core_immunization.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_immunization.rb rename to ui_suites/onc_program/single_patient_api/us_core_immunization.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_implantable_device.rb b/ui_suites/onc_program/single_patient_api/us_core_implantable_device.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_implantable_device.rb rename to ui_suites/onc_program/single_patient_api/us_core_implantable_device.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_medication_request.rb b/ui_suites/onc_program/single_patient_api/us_core_medication_request.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_medication_request.rb rename to ui_suites/onc_program/single_patient_api/us_core_medication_request.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_observation_lab.rb b/ui_suites/onc_program/single_patient_api/us_core_observation_lab.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_observation_lab.rb rename to ui_suites/onc_program/single_patient_api/us_core_observation_lab.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_organization.rb b/ui_suites/onc_program/single_patient_api/us_core_organization.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_organization.rb rename to ui_suites/onc_program/single_patient_api/us_core_organization.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_patient.rb b/ui_suites/onc_program/single_patient_api/us_core_patient.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_patient.rb rename to ui_suites/onc_program/single_patient_api/us_core_patient.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_pediatric_bmi_for_age.rb b/ui_suites/onc_program/single_patient_api/us_core_pediatric_bmi_for_age.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_pediatric_bmi_for_age.rb rename to ui_suites/onc_program/single_patient_api/us_core_pediatric_bmi_for_age.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_pediatric_weight_for_height.rb b/ui_suites/onc_program/single_patient_api/us_core_pediatric_weight_for_height.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_pediatric_weight_for_height.rb rename to ui_suites/onc_program/single_patient_api/us_core_pediatric_weight_for_height.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_practitioner.rb b/ui_suites/onc_program/single_patient_api/us_core_practitioner.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_practitioner.rb rename to ui_suites/onc_program/single_patient_api/us_core_practitioner.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_procedure.rb b/ui_suites/onc_program/single_patient_api/us_core_procedure.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_procedure.rb rename to ui_suites/onc_program/single_patient_api/us_core_procedure.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_provenance.rb b/ui_suites/onc_program/single_patient_api/us_core_provenance.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_provenance.rb rename to ui_suites/onc_program/single_patient_api/us_core_provenance.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_pulse_oximetry.rb b/ui_suites/onc_program/single_patient_api/us_core_pulse_oximetry.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_pulse_oximetry.rb rename to ui_suites/onc_program/single_patient_api/us_core_pulse_oximetry.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_resp_rate.rb b/ui_suites/onc_program/single_patient_api/us_core_resp_rate.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_resp_rate.rb rename to ui_suites/onc_program/single_patient_api/us_core_resp_rate.rb diff --git a/dev_suites/onc_program/single_patient_api/us_core_smoking_status.rb b/ui_suites/onc_program/single_patient_api/us_core_smoking_status.rb similarity index 100% rename from dev_suites/onc_program/single_patient_api/us_core_smoking_status.rb rename to ui_suites/onc_program/single_patient_api/us_core_smoking_status.rb diff --git a/dev_suites/onc_program/standalone_patient_app_full_access.rb b/ui_suites/onc_program/standalone_patient_app_full_access.rb similarity index 89% rename from dev_suites/onc_program/standalone_patient_app_full_access.rb rename to ui_suites/onc_program/standalone_patient_app_full_access.rb index 367b9c486..2417edb82 100644 --- a/dev_suites/onc_program/standalone_patient_app_full_access.rb +++ b/ui_suites/onc_program/standalone_patient_app_full_access.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'standalone_patient_app_full_access', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class StandalonePatientAppFullAccess < Inferno::TestGroup title 'Standalone Patient App - Full Patient Access' diff --git a/dev_suites/onc_program/standalone_patient_app_full_access/access_verify_unrestricted.rb b/ui_suites/onc_program/standalone_patient_app_full_access/access_verify_unrestricted.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_full_access/access_verify_unrestricted.rb rename to ui_suites/onc_program/standalone_patient_app_full_access/access_verify_unrestricted.rb diff --git a/dev_suites/onc_program/standalone_patient_app_full_access/standalone_launch.rb b/ui_suites/onc_program/standalone_patient_app_full_access/standalone_launch.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_full_access/standalone_launch.rb rename to ui_suites/onc_program/standalone_patient_app_full_access/standalone_launch.rb diff --git a/dev_suites/onc_program/standalone_patient_app_full_access/standalone_openid_connect.rb b/ui_suites/onc_program/standalone_patient_app_full_access/standalone_openid_connect.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_full_access/standalone_openid_connect.rb rename to ui_suites/onc_program/standalone_patient_app_full_access/standalone_openid_connect.rb diff --git a/dev_suites/onc_program/standalone_patient_app_full_access/standalone_smart_discovery.rb b/ui_suites/onc_program/standalone_patient_app_full_access/standalone_smart_discovery.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_full_access/standalone_smart_discovery.rb rename to ui_suites/onc_program/standalone_patient_app_full_access/standalone_smart_discovery.rb diff --git a/dev_suites/onc_program/standalone_patient_app_full_access/standalone_token_refresh.rb b/ui_suites/onc_program/standalone_patient_app_full_access/standalone_token_refresh.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_full_access/standalone_token_refresh.rb rename to ui_suites/onc_program/standalone_patient_app_full_access/standalone_token_refresh.rb diff --git a/dev_suites/onc_program/standalone_patient_app_limited_access.rb b/ui_suites/onc_program/standalone_patient_app_limited_access.rb similarity index 83% rename from dev_suites/onc_program/standalone_patient_app_limited_access.rb rename to ui_suites/onc_program/standalone_patient_app_limited_access.rb index 452c05e25..b9cdfd976 100644 --- a/dev_suites/onc_program/standalone_patient_app_limited_access.rb +++ b/ui_suites/onc_program/standalone_patient_app_limited_access.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, 'standalone_patient_app_limited_access', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class StandalonePatientAppLimitedAccess < Inferno::TestGroup title 'Standalone Patient App - Limited Access' diff --git a/dev_suites/onc_program/standalone_patient_app_limited_access/access_verify_restricted.rb b/ui_suites/onc_program/standalone_patient_app_limited_access/access_verify_restricted.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_limited_access/access_verify_restricted.rb rename to ui_suites/onc_program/standalone_patient_app_limited_access/access_verify_restricted.rb diff --git a/dev_suites/onc_program/standalone_patient_app_limited_access/standalone_restricted_launch.rb b/ui_suites/onc_program/standalone_patient_app_limited_access/standalone_restricted_launch.rb similarity index 100% rename from dev_suites/onc_program/standalone_patient_app_limited_access/standalone_restricted_launch.rb rename to ui_suites/onc_program/standalone_patient_app_limited_access/standalone_restricted_launch.rb diff --git a/dev_suites/onc_program/suite.rb b/ui_suites/onc_program/suite.rb similarity index 80% rename from dev_suites/onc_program/suite.rb rename to ui_suites/onc_program/suite.rb index 92d6bc94a..e99dd418d 100644 --- a/dev_suites/onc_program/suite.rb +++ b/ui_suites/onc_program/suite.rb @@ -1,3 +1,5 @@ +Dir.glob(File.join(__dir__, '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") } + module ONCProgram class Suite < Inferno::TestSuite title '2015 Edition Cures Update - Standardized API Testing' diff --git a/dev_suites/smart_scheduling_links/suite.rb b/ui_suites/smart_scheduling_links/suite.rb similarity index 100% rename from dev_suites/smart_scheduling_links/suite.rb rename to ui_suites/smart_scheduling_links/suite.rb diff --git a/webpack.config.js b/webpack.config.js index f8d7ea4cb..75bb20964 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,7 +6,7 @@ module.exports = (env, argv) => { return { entry: './client/src/index.tsx', output: { - path: path.resolve(__dirname, 'public'), + path: path.resolve(__dirname, 'lib', 'inferno', 'public'), filename: 'bundle.js', publicPath: '/public/', }, @@ -63,9 +63,9 @@ module.exports = (env, argv) => { }, plugins: [ new WebpackManifestPlugin({ - fileName: path.resolve(__dirname, 'public/assets.json') + fileName: path.resolve(__dirname, 'lib', 'inferno', 'public', 'assets.json') }), new webpack.HotModuleReplacementPlugin() ] } -} \ No newline at end of file +}