def test_history_of(self):
     date_module_result = DateModuleResultFactory.build()
     kalibro_module = KalibroModuleFactory.build()
     response_kalibro_module = {'kalibro_module': kalibro_module._asdict()}
     repository_id = 1
     response = {'module_result_history_of': [[date_module_result.date, self.subject._asdict()]]}
     with patch.object(Repository, 'request',
                       return_value=response) as module_result_history_request, \
          patch.object(ModuleResult, 'request', return_value=response_kalibro_module) as kalibro_module_request:
         history_module_results = ModuleResult.history_of(
                                                 module_result=self.subject,
                                                 repository_id=repository_id)
         assert_equal([date_module_result], history_module_results)
         module_result_history_request.assert_called_once_with(
                                         action=':id/module_result_history_of',
                                         params={'id': repository_id,
                                                 'kalibro_module_id': self.subject.kalibro_module.id})
         kalibro_module_request.assert_called_once_with(action=':id/kalibro_module', params={'id': self.subject.id},
                                                        method='get')
 def setUp(self):
     self.subject = DateModuleResultFactory.build()
     self.module_result = ModuleResultFactory.build()
     self.second_subject = DateModuleResultFactory.build(date=None, module_result = self.module_result)