def test_get_environment_section(self): """ Test that the environment can be found. """ environment = domain.Environment(short_name='ENV') self.__project.add_environment(environment) quality_report = report.QualityReport(self.__project) section = quality_report.get_section('ENV') self.assertEqual('ENV', section.id_prefix())
def test_value_with_multiple_sources(self): """ Test that the value is '0.0' when multiple metric source have been configured, but not metric source id. """ sonar1, sonar2 = FakeSonar(), FakeSonar() version = metric.SonarPluginVersionJava( project=domain.Project(metric_sources={metric_source.Sonar: [sonar1, sonar2]}), subject=domain.Environment()) self.assertEqual(LooseVersion('0.0'), version.value())
def setUp(self): sonar = FakeSonar() self.__project = domain.Project( metric_sources={metric_source.Sonar: sonar}) self.__environment = domain.Environment( metric_source_ids={sonar: 'dummy'}) self.__metric = metric.SonarQualityProfileVersionJava( project=self.__project, subject=self.__environment)
def test_url_empty(self): """ Test that the url is empty for empty metric source. """ project = domain.Project(metric_sources={metric_source.Sonar: []}) environment = domain.Environment( metric_source_ids={FakeSonar(): 'dummy'}) self.__metric = metric.SonarVersion(project=project, subject=environment) self.assertEqual({}, self.__metric.url())
def test_missing(self): """ Test that the value is -1 without a metric source. """ self.assertEqual(-1, metric.SonarVersion(project=domain.Project(), subject=domain.Environment()).value())
def setUp(self): sonar = FakeSonar() project = domain.Project(metric_sources={metric_source.Sonar: sonar}) environment = domain.Environment(metric_source_ids={sonar: 'dummy'}) self.__metric = metric.SonarVersion(project=project, subject=environment)
def test_add_environment(self): """ Test that an environment can be added to the project. """ environment = domain.Environment() self.__project.add_environment(environment) self.assertEqual([environment], self.__project.environments())
def test_environment_in_domain_object_classes(self): """ Test that the environment class is included in the domain object classes. """ project = domain.Project() project.add_environment(domain.Environment()) self.assertEqual({domain.Environment}, project.domain_object_classes())
def test_default_requirements(self): """ Test that an environment can be created. """ self.assertEqual( (requirement.TrackCIJobs, requirement.TrackSonarVersion), domain.Environment().default_requirements())
def test_short_name(self): """ Test the environment short name. """ self.assertEqual( 'AC', domain.Environment('Acceptance environment', short_name='AC').short_name())
def test_name(self): """ Test the environment name. """ self.assertEqual('Dev environment', domain.Environment('Dev environment').name())