added tests for missing license and non-CA

Mon, 24 Jun 2019 01:06:37 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 24 Jun 2019 01:06:37 +0300
changeset 86
b25fc6f7eb70
parent 85
4438502fd3e0
child 87
90105119ff90

added tests for missing license and non-CA

tests/misc.py file | annotate | diff | comparison | revisions
--- a/tests/misc.py	Mon Jun 24 01:01:45 2019 +0300
+++ b/tests/misc.py	Mon Jun 24 01:06:37 2019 +0300
@@ -46,14 +46,33 @@
     severity = 'hold',
     message = lambda reason: str.format('bad header: {}', reason),
 )
+@problem_type('no-license-set',
+    severity = 'hold',
+    message = 'no license set',
+)
+@problem_type('non-ca-license',
+    severity = 'hold',
+    message = 'no new non-CA-submits are accepted',
+)
 def bad_header(model):
     import header
+    ca_license = 'Redistributable under CCAL version 2.0 : see CAreadme.txt'
     if isinstance(model.header, header.BadHeader):
         yield report_problem(
             'bad-header',
             bad_object = model.body[model.header.index],
             reason = model.header.reason,
         )
+    elif not model.header.license:
+        yield report_problem(
+            'no-license-set',
+            bad_object = model.body[0],
+        )
+    elif model.header.license != ca_license:
+        yield report_problem(
+            'non-ca-license',
+            bad_object = model.find_first_header_object('license'),
+        )
 
 @problem_type('bfc-nocertify',
     severity = 'hold',

mercurial