2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
class TestCaseEntity < Grape::Entity
|
2020-04-22 19:07:51 +05:30
|
|
|
include API::Helpers::RelatedResourcesHelpers
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
expose :status
|
|
|
|
expose :name
|
2019-09-04 21:01:54 +05:30
|
|
|
expose :classname
|
2018-11-18 11:00:15 +05:30
|
|
|
expose :execution_time
|
|
|
|
expose :system_output
|
|
|
|
expose :stack_trace
|
2020-04-22 19:07:51 +05:30
|
|
|
expose :attachment_url, if: -> (*) { can_read_screenshots? } do |test_case|
|
|
|
|
expose_url(test_case.attachment_url)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
alias_method :test_case, :object
|
|
|
|
|
|
|
|
def can_read_screenshots?
|
|
|
|
Feature.enabled?(:junit_pipeline_screenshots_view, options[:project]) && test_case.has_attachment?
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|