-
Notifications
You must be signed in to change notification settings - Fork 2
/
mappings
executable file
·33 lines (27 loc) · 1.42 KB
/
mappings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
import os
import shutil
import filecmp
import unittest
import subprocess
from glob import glob
class MappingsTests(unittest.TestCase):
def test_generate(self):
EXPECTED = b"Generating scenario's instances:\n \xe2\x9c\x85 1 TM, 5 POMs\n \xe2\x9c\x85 10 TMs, 5 POMs\n \xe2\x9c\x85 20 TMs, 1 POM\n \xe2\x9c\x85 20 TMs, 3 POMs\n \xe2\x9c\x85 20 TMs, 5 POMs\n \xe2\x9c\x85 20 TMs, 10 POMs\n \xe2\x9c\x85 30 TMs, 5 POMs\n"
shutil.rmtree('RMLStreamer', ignore_errors=True)
CMD = ['../exgentool', '--root', '.', '--scenario',
'data/tests-mappings.json', 'generate']
output = subprocess.check_output(CMD)
self.assertEqual(output, EXPECTED)
for f in glob('RMLStreamer/csv/*/data.csv'):
result = filecmp.cmp(f, os.path.join('data', 'tests-mappings', f))
self.assertTrue(result)
shutil.rmtree('RMLStreamer', ignore_errors=True)
def test_list(self):
EXPECTED = b"Scenario's instances:\n 1. 1 TM, 5 POMs\n 2. 10 TMs, 5 POMs\n 3. 20 TMs, 1 POM\n 4. 20 TMs, 3 POMs\n 5. 20 TMs, 5 POMs\n 6. 20 TMs, 10 POMs\n 7. 30 TMs, 5 POMs\n"
CMD = ['../exgentool', '--root', '.', '--scenario',
'data/tests-mappings.json', 'list']
output = subprocess.check_output(CMD)
self.assertEqual(output, EXPECTED)
if __name__ == '__main__':
unittest.main()