def test_report_no_vcs_path(self): """ Test the report when there's no version control system path. """ document = domain.Document(name='Title', url='http://doc') age = metric.DocumentAge(subject=document, project=self.__project) self.assertEqual( 'De document update leeftijd van Title kon niet gemeten worden omdat niet alle ' 'benodigde bron-ids zijn geconfigureerd. Configureer ids voor de bron VersionControlSystem.', age.report())
def test_report_no_vcs(self): """ Test the report when there's no version control system. """ project = domain.Project() document = domain.Document( name='Title', url='http://doc', metric_source_ids={self.__subversion: 'path'}) age = metric.DocumentAge(subject=document, project=project) self.assertEqual( 'De document update leeftijd van Title kon niet gemeten worden omdat de bron ' 'VersionControlSystem niet is geconfigureerd.', age.report())
def setUp(self): self.__subversion = FakeSubversion() self.__document = domain.Document( name='Title', url='http://doc', metric_source_ids={self.__subversion: 'raise'}) self.__project = domain.Project( metric_sources={ metric_source.VersionControlSystem: self.__subversion }) self.__metric = metric.DocumentAge(subject=self.__document, project=self.__project)
def test_document_overrides_target(self): """ Test that the document can override the default target value. """ document = domain.Document( name='Title', metric_options={metric.DocumentAge: dict(target=20)}) age = metric.DocumentAge(subject=document, project=self.__project) self.assertEqual(document.target(metric.DocumentAge), age.target())