File: tests.py

package info (click to toggle)
stepic 0.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: python: 208; makefile: 32; sh: 8
file content (28 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (2)
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
import unittest
import os
try:
    import stepic
except ImportError:
    import sys
    sys.path.append('../stepic')
    import stepic

class TestStepic(unittest.TestCase):

    def test_stepic(self):

        keep = False

        stepic.encode_files('tests/test_img.png', 'tests/test_text.txt', 'tests/encoded.png', None)
        stepic.decode_files('tests/encoded.png', 'tests/encoded.txt')
        textfile = open('tests/encoded.txt')
        text = textfile.read()
        textfile.close()
        if not keep:
            os.remove('tests/encoded.txt')
            os.remove('tests/encoded.png')
        self.assertEqual(text, "The quick brown fox jumped over the lazy dog.\n", "Decoded text incorrect")

if __name__ == '__main__':
    unittest.main()