Skip to content

Commit 2634e21

Browse files
committed
Added a bit of additional checking to test_submit_invalid_yang.
- Legacy-Id: 15869
1 parent 69c2e84 commit 2634e21

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

ietf/submit/checkers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import tempfile
1010
import StringIO
1111

12+
from collections import deque
1213
from django.conf import settings
1314

1415
import debug # pyflakes:ignore
@@ -18,6 +19,8 @@
1819
from ietf.utils.pipe import pipe
1920
from ietf.utils.test_runner import set_coverage_checking
2021

22+
cmd_pipe_results = deque([], 4)
23+
2124
class DraftSubmissionChecker():
2225
name = ""
2326

@@ -71,6 +74,8 @@ def check_file_txt(self, path):
7174
Error and warning list items are tuples:
7275
(line_number, line_text, message)
7376
"""
77+
global cmd_pipe_results
78+
7479
items = []
7580
errors = 0
7681
warnings = 0
@@ -80,6 +85,7 @@ def check_file_txt(self, path):
8085

8186
cmd = "%s %s %s" % (settings.IDSUBMIT_IDNITS_BINARY, self.options, path)
8287
code, out, err = pipe(cmd)
88+
cmd_pipe_results.append((code, out, err))
8389
if code != 0 or out == "":
8490
message = "idnits error: %s:\n Error %s: %s" %( cmd, code, err)
8591
log(message)
@@ -204,6 +210,7 @@ def check_file_txt(self, path):
204210
cmd_version = VersionInfo.objects.get(command=command).version
205211
cmd = cmd_template.format(libs=modpath, model=path)
206212
code, out, err = pipe(cmd)
213+
cmd_pipe_results.append((code, out, err))
207214
if code > 0 or len(err.strip()) > 0 :
208215
error_lines = err.splitlines()
209216
assertion('len(error_lines) > 0')
@@ -235,6 +242,7 @@ def check_file_txt(self, path):
235242
cmd = cmd_template.format(model=path, rfclib=settings.SUBMIT_YANG_RFC_MODEL_DIR, tmplib=workdir,
236243
draftlib=settings.SUBMIT_YANG_DRAFT_MODEL_DIR, ianalib=settings.SUBMIT_YANG_IANA_MODEL_DIR, )
237244
code, out, err = pipe(cmd)
245+
cmd_pipe_results.append((code, out, err))
238246
if code > 0 or len(err.strip()) > 0:
239247
error_lines = err.splitlines()
240248
for line in error_lines:

ietf/submit/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
from ietf.name.models import FormalLanguageName
3232
from ietf.person.models import Person
3333
from ietf.person.factories import UserFactory, PersonFactory
34+
from ietf.submit.checkers import cmd_pipe_results
35+
3436
from ietf.submit.models import Submission, Preapproval
3537
from ietf.submit.mail import add_submission_email, process_response_email
3638
from ietf.utils.mail import outbox, empty_outbox
@@ -1037,6 +1039,7 @@ def test_submit_invalid_yang(self):
10371039
q = PyQuery(r.content)
10381040
#
10391041
self.assertContains(r, u'The yang validation returned 1 error')
1042+
self.assertIn('illegal keyword', cmd_pipe_results[-2][2])
10401043
#
10411044
m = q('#yang-validation-message').text()
10421045
for command in ['xym', 'pyang', 'yanglint']:

0 commit comments

Comments
 (0)