aboutsummaryrefslogtreecommitdiffstats
path: root/tests/api/__init__.py
blob: dcee5b53b85b503e7ebe02b3502d4dccdf8029cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from subprocess import CompletedProcess
from unittest import mock

from falcon import testing

from snekbox.api import SnekAPI


class SnekAPITestCase(testing.TestCase):
    def setUp(self):
        super().setUp()

        self.patcher = mock.patch("snekbox.api.resources.eval.NsJail", autospec=True)
        self.mock_nsjail = self.patcher.start()
        self.mock_nsjail.return_value.python3.return_value = CompletedProcess(
            args=[],
            returncode=0,
            stdout="output",
            stderr="error"
        )
        self.addCleanup(self.patcher.stop)

        self.app = SnekAPI()