Skip to content

Commit 3e268ea

Browse files
committed
Updated invalid stein testscases
1 parent 7b495ee commit 3e268ea

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

tests/unittests/test_invalid_stein.py

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33
import collections as col
4-
import os
5-
from unittest.mock import patch
64

75
from azure_functions_worker import protos
86
from tests.utils import testutils
@@ -19,51 +17,24 @@
1917

2018
class TestInvalidAppStein(testutils.AsyncTestCase):
2119

22-
def setUp(self):
23-
self._ctrl = testutils.start_mockhost(
24-
script_root=STEIN_INVALID_APP_FUNCTIONS_DIR)
25-
self._pre_env = dict(os.environ)
26-
self.mock_version_info = patch(
27-
'azure_functions_worker.dispatcher.sys.version_info',
28-
SysVersionInfo(3, 9, 0, 'final', 0))
29-
self.mock_version_info.start()
30-
31-
def tearDown(self):
32-
os.environ.clear()
33-
os.environ.update(self._pre_env)
34-
self.mock_version_info.stop()
35-
3620
async def test_indexing_not_app(self):
3721
"""Test if the functions metadata response will be 0
3822
when an invalid app is provided
3923
"""
40-
async with self._ctrl as host:
24+
mock_host = testutils.start_mockhost(
25+
script_root=STEIN_INVALID_APP_FUNCTIONS_DIR)
26+
async with mock_host as host:
4127
r = await host.get_functions_metadata()
4228
self.assertIsInstance(r.response, protos.FunctionMetadataResponse)
4329
self.assertIn("Error", r.response.result.exception.message)
4430

45-
46-
class TestInvalidStein(testutils.AsyncTestCase):
47-
48-
def setUp(self):
49-
self._ctrl = testutils.start_mockhost(
50-
script_root=STEIN_INVALID_FUNCTIONS_DIR)
51-
self._pre_env = dict(os.environ)
52-
self.mock_version_info = patch(
53-
'azure_functions_worker.dispatcher.sys.version_info',
54-
SysVersionInfo(3, 9, 0, 'final', 0))
55-
self.mock_version_info.start()
56-
57-
def tearDown(self):
58-
os.environ.clear()
59-
os.environ.update(self._pre_env)
60-
self.mock_version_info.stop()
61-
6231
async def test_indexing_invalid_app(self):
6332
"""Test if the functions metadata response will be 0
6433
when an invalid app is provided
6534
"""
66-
async with self._ctrl as host:
35+
mock_host = testutils.start_mockhost(
36+
script_root=STEIN_INVALID_APP_FUNCTIONS_DIR)
37+
async with mock_host as host:
6738
r = await host.get_functions_metadata()
6839
self.assertIsInstance(r.response, protos.FunctionMetadataResponse)
6940
self.assertIn("Error", r.response.result.exception.message)

0 commit comments

Comments
 (0)