File: jail_test.py

package info (click to toggle)
python-mitogen 0.3.0~rc1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,240 kB
  • sloc: python: 19,899; sh: 91; perl: 19; ansic: 18; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 769 bytes parent folder | download
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

import os

import mitogen
import mitogen.parent

import unittest2

import testlib


class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
    jexec_path = testlib.data_path('stubs/stub-jexec.py')

    def test_okay(self):
        context = self.router.jail(
            jexec_path=self.jexec_path,
            container='somejail',
        )
        stream = self.router.stream_by_id(context.context_id)

        argv = eval(context.call(os.getenv, 'ORIGINAL_ARGV'))
        self.assertEquals(argv[:4], [
            self.jexec_path,
            'somejail',
            stream.conn.options.python_path,
            '-c',
        ])
        self.assertEquals('1', context.call(os.getenv, 'THIS_IS_STUB_JEXEC'))


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