Exemplo n.º 1
0
 def test_at_end_date(self):
     """ Test that the target value equals the end target value if the current date is at the end date. """
     now = datetime.datetime.now()
     target = DynamicTechnicalDebtTarget(100,
                                         now - datetime.timedelta(days=20),
                                         200, now)
     self.assertEqual(200, target.target_value())
Exemplo n.º 2
0
 def test_halfway(self):
     """ Test that the target value is half way the initial target value and the end target value
         if the current date is half way. """
     now = datetime.datetime.now()
     target = DynamicTechnicalDebtTarget(100,
                                         now - datetime.timedelta(days=10),
                                         200,
                                         now + datetime.timedelta(days=10))
     self.assertEqual(150, target.target_value())
Exemplo n.º 3
0
 def test_before_initial_date(self):
     """ Test that the target value equals the initial target value if the current date is before the
         initial date. """
     now = datetime.datetime.now()
     target = DynamicTechnicalDebtTarget(100,
                                         now + datetime.timedelta(days=10),
                                         200,
                                         now + datetime.timedelta(days=20))
     self.assertEqual(100, target.target_value())
Exemplo n.º 4
0
 def test_custom_explanation(self):
     """ Test that the custom explanation is added to the default explanation. """
     now = datetime.datetime.now()
     start = now - datetime.timedelta(days=10)
     end = now + datetime.timedelta(days=10)
     target = DynamicTechnicalDebtTarget(200, start, 100, end, 'Extra.')
     self.assertEqual(
         'Het doel is dat de technische schuld vermindert van {0} op {1} naar {2} op {3}. '
         'De op dit moment geaccepteerde technische schuld is {4}. Extra.'.
         format(200, format_date(start, year=True), 100,
                format_date(end, year=True), target.target_value()),
         target.explanation())
Exemplo n.º 5
0
 def test_default_explanation(self):
     """ Test that the default explanation shows the period. """
     now = datetime.datetime.now()
     start = now - datetime.timedelta(days=10)
     end = now + datetime.timedelta(days=10)
     target = DynamicTechnicalDebtTarget(200, start, 100, end)
     self.assertEqual(
         'Het doel is dat de technische schuld vermindert van {0} LOC op {1} naar {2} LOC op {3}. '
         'De op dit moment geaccepteerde technische schuld is {4} LOC.'.
         format(200, format_date(start, year=True), 100,
                format_date(end, year=True), target.target_value()),
         target.explanation('LOC'))
Exemplo n.º 6
0
QUALITY_REPORT = Application(
    short_name='QR',
    name='Example product',
    metric_source_ids={
        SONAR: 'nl.comp:my_project',
        JUNIT: "http://www.junit.report.url/junit.xml",
        JACOCO: 'quality-report-coverage-report',
        ZAP_SCAN_REPORT: 'http://jenkins/job/zap_scan/ws/report.html'
    },
    metric_options={
        metric.UnittestLineCoverage:
        dict(debt_target=TechnicalDebtTarget(
            0, 'Sonar incorrectly reports 0% unit test coverage')),
        metric.MajorViolations:
        dict(debt_target=DynamicTechnicalDebtTarget(
            47, datetime.datetime(2014, 2, 12), 25,
            datetime.datetime(2014, 6, 1))),
        metric.UnmergedBranches:
        dict(branches_to_ignore=['spike'],
             comment="Ignore the spike branch (2016-06-15).")
    })

SECURITY_REPORT = Document(
    name='Security report',
    url='http://url/to/report',
    added_requirements=[requirement.TrackSecurityTestDate],
    metric_source_ids={
        SECURITY_REPORT_PROXY: 'https://last_security_date_url'
    })

PROJECT.add_document(SECURITY_REPORT)