Class: Datadog::CI::TestManagement::TestsProperties::Response
- Inherits:
-
Object
- Object
- Datadog::CI::TestManagement::TestsProperties::Response
- Defined in:
- lib/datadog/ci/test_management/tests_properties.rb
Instance Method Summary collapse
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
- #tests ⇒ Object
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
18 19 20 21 |
# File 'lib/datadog/ci/test_management/tests_properties.rb', line 18 def initialize(http_response) @http_response = http_response @json = nil end |
Instance Method Details
#ok? ⇒ Boolean
23 24 25 26 |
# File 'lib/datadog/ci/test_management/tests_properties.rb', line 23 def ok? resp = @http_response !resp.nil? && resp.ok? end |
#tests ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/datadog/ci/test_management/tests_properties.rb', line 28 def tests tests_map = {} payload .fetch("data", {}) .fetch("attributes", {}) .fetch("modules", {}) .each do |_test_module, module_hash| module_hash .fetch("suites", {}) .each do |test_suite, suite_hash| suite_hash.fetch("tests", {}) .each do |test_name, properties_hash| properties = properties_hash.fetch("properties", {}) properties.transform_values! { |v| Utils::Parsing.convert_to_bool(v) } tests_map[Utils::TestRun.datadog_test_id(test_name, test_suite)] = properties end end end tests_map end |