def test_history_of(self):
        date_metric_result = DateMetricResultFactory.build()
        kalibro_module = KalibroModuleFactory.build(id = 2)
        native_metric = NativeMetricFactory.build()
        repository = RepositoryFactory.build(id = 3)

        metric_result_history_of_hash = {'metric_result_history_of': [date_metric_result._asdict()]}
        with patch.object(Repository, 'request', return_value=metric_result_history_of_hash) as request_mock:
            assert_equal(TreeMetricResult.history_of(native_metric.name, kalibro_module.id,
                                                 repository.id),
                         [date_metric_result])
            request_mock.assert_called_once_with(action=':id/metric_result_history_of',
                                                 params={'metric_name': native_metric.name,
                                                         'kalibro_module_id': kalibro_module.id,
                                                         'id': repository.id})
예제 #2
0
 def tree_metric_results(self):
     return TreeMetricResult.response_to_objects_array(self.request(
                                             action=':id/metric_results',
                                             params={'id': self.id},
                                             method='get'))
예제 #3
0
def step_impl(context):
    context.response = TreeMetricResult.history_of(context.metric.name, context.response.root_module_result_id, context.repository.id)