|
| 1 | +import debug # pyflakes:ignore |
| 2 | +import shutil |
| 3 | +import os |
| 4 | + |
| 5 | +from contextlib import closing |
| 6 | +from tempfile import mkdtemp |
| 7 | + |
| 8 | +from ietf.submit.tests import submission_file |
| 9 | +from ietf.utils.test_utils import TestCase |
| 10 | +from ietf.utils.draft import Draft, getmeta |
| 11 | + |
| 12 | +class DraftTests(TestCase): |
| 13 | + |
| 14 | + def setUp(self): |
| 15 | + file,_ = submission_file(name='draft-test-draft-class',rev='00',format='txt',templatename='test_submission.txt',group=None) |
| 16 | + self.draft = Draft(text=file.getvalue(),source='draft-test-draft-class-00.txt',name_from_source=False) |
| 17 | + |
| 18 | + def test_get_status(self): |
| 19 | + self.assertEqual(self.draft.get_status(),'Informational') |
| 20 | + |
| 21 | + def test_get_authors(self): |
| 22 | + self.assertTrue(all([u'@' in author for author in self.draft.get_authors()])) |
| 23 | + |
| 24 | + def test_get_authors_with_firm(self): |
| 25 | + self.assertTrue(all([u'@' in author for author in self.draft.get_authors_with_firm()])) |
| 26 | + |
| 27 | + def test_old_get_refs(self): |
| 28 | + self.assertEqual(self.draft.old_get_refs()[1][0],u'rfc2119') |
| 29 | + |
| 30 | + def test_get_meta(self): |
| 31 | + tempdir = mkdtemp() |
| 32 | + filename = os.path.join(tempdir,self.draft.source) |
| 33 | + with closing(open(filename,'w')) as file: |
| 34 | + file.write(self.draft.text) |
| 35 | + self.assertEqual(getmeta(filename)['docdeststatus'],'Informational') |
0 commit comments