From 8d9a0029bd3c8a8629fbf8db3903b412bef538e1 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Wed, 29 May 2019 03:12:47 -0700 Subject: Add API tests for eval resource --- tests/api/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/api/__init__.py (limited to 'tests/api/__init__.py') diff --git a/tests/api/__init__.py b/tests/api/__init__.py new file mode 100644 index 0000000..745519d --- /dev/null +++ b/tests/api/__init__.py @@ -0,0 +1,16 @@ +from unittest import mock + +from falcon import testing + + +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 = "test output" + self.addCleanup(self.patcher.stop) + + from snekbox.api import SnekAPI + self.app = SnekAPI() -- cgit v1.2.3 From feaae8cab07b3db7d0baf3de7b7bb5b515e9acf8 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Wed, 29 May 2019 16:22:30 -0700 Subject: Move SnekAPI import back to top of module --- tests/api/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/api/__init__.py') diff --git a/tests/api/__init__.py b/tests/api/__init__.py index 745519d..fd4679a 100644 --- a/tests/api/__init__.py +++ b/tests/api/__init__.py @@ -2,6 +2,8 @@ from unittest import mock from falcon import testing +from snekbox.api import SnekAPI + class SnekAPITestCase(testing.TestCase): def setUp(self): @@ -12,5 +14,4 @@ class SnekAPITestCase(testing.TestCase): self.mock_nsjail.return_value.python3.return_value = "test output" self.addCleanup(self.patcher.stop) - from snekbox.api import SnekAPI self.app = SnekAPI() -- cgit v1.2.3