tests/misc.py

changeset 86
b25fc6f7eb70
parent 78
1970afe52da4
child 87
90105119ff90
--- 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