def test_descendant_hotspot_metric_results(self):
     hotspot_metric_result = HotspotMetricResultFactory.build()
     response = {'hotspot_metric_results': [hotspot_metric_result._asdict()]}
     with patch.object(self.subject, 'request', return_value=response) as hotspot_metric_results_request:
         hotspot_metric_results = self.subject.descendant_hotspot_metric_results()
         assert_equal(hotspot_metric_results, [hotspot_metric_result])
         hotspot_metric_results_request.assert_called_once_with(
             action=":id/descendant_hotspot_metric_results", params={"id": self.subject.id}, method="get")
    def test_related_results(self):
        related_results = [HotspotMetricResultFactory.build(id=id_) for id_ in range(3)]
        related_results_hash = {'hotspot_metric_results': [related_result._asdict()
                                                           for related_result in related_results]}

        with patch.object(self.subject, 'request', return_value=related_results_hash) as request_mock:
            assert_equal(self.subject.related_results(), related_results)
            request_mock.assert_called_once_with(action=':id/related_results', params={'id': self.subject.id},
                                                 method='get')
 def setUp(self):
     self.subject = HotspotMetricResultFactory.build()