corrade-nucleus-nucleons – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
2 | office | 1 | # |
2 | # written by Stefano Sanfilippo <a.little.coder@gmail.com> |
||
3 | # |
||
4 | |||
5 | """Tests for MyObfuscate unpacker.""" |
||
6 | |||
7 | import unittest |
||
8 | import os |
||
9 | from jsbeautifier.unpackers.myobfuscate import detect, unpack |
||
10 | from jsbeautifier.unpackers.tests import __path__ as path |
||
11 | |||
12 | INPUT = os.path.join(path[0], 'test-myobfuscate-input.js') |
||
13 | OUTPUT = os.path.join(path[0], 'test-myobfuscate-output.js') |
||
14 | |||
15 | # pylint: disable=R0904 |
||
16 | class TestMyObfuscate(unittest.TestCase): |
||
17 | # pylint: disable=C0103 |
||
18 | """MyObfuscate obfuscator testcase.""" |
||
19 | @classmethod |
||
20 | def setUpClass(cls): |
||
21 | """Load source files (encoded and decoded version) for tests.""" |
||
22 | with open(INPUT, 'r') as data: |
||
23 | cls.input = data.read() |
||
24 | with open(OUTPUT, 'r') as data: |
||
25 | cls.output = data.read() |
||
26 | |||
27 | def test_detect(self): |
||
28 | """Test detect() function.""" |
||
29 | detected = lambda source: self.assertTrue(detect(source)) |
||
30 | |||
31 | detected(self.input) |
||
32 | |||
33 | def test_unpack(self): |
||
34 | """Test unpack() function.""" |
||
35 | check = lambda inp, out: self.assertEqual(unpack(inp), out) |
||
36 | |||
37 | check(self.input, self.output) |
||
38 | |||
39 | if __name__ == '__main__': |
||
40 | unittest.main() |