Fixed unit test
This commit is contained in:
parent
54d5365907
commit
d4832ad2b8
|
@ -53,21 +53,25 @@ class TestApp(TestCase):
|
||||||
self.assertEqual(app.convert_str_to_bool(True), None)
|
self.assertEqual(app.convert_str_to_bool(True), None)
|
||||||
|
|
||||||
@mock.patch('src.app.prepare_avd')
|
@mock.patch('src.app.prepare_avd')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('subprocess.Popen')
|
@mock.patch('subprocess.Popen')
|
||||||
def test_run_with_appium(self, mocked_avd, mocked_subprocess):
|
def test_run_with_appium(self, mocked_avd, mocked_open, mocked_subprocess):
|
||||||
with mock.patch('src.app.appium_run') as mocked_appium:
|
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||||
os.environ['APPIUM'] = str(True)
|
os.environ['APPIUM'] = str(True)
|
||||||
app.run()
|
app.run()
|
||||||
self.assertTrue(mocked_avd.called)
|
self.assertTrue(mocked_avd.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
self.assertTrue(mocked_subprocess.called)
|
self.assertTrue(mocked_subprocess.called)
|
||||||
self.assertTrue(mocked_appium.called)
|
self.assertTrue(mocked_appium.called)
|
||||||
|
|
||||||
@mock.patch('src.app.prepare_avd')
|
@mock.patch('src.app.prepare_avd')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('subprocess.Popen')
|
@mock.patch('subprocess.Popen')
|
||||||
def test_run_withhout_appium(self, mocked_avd, mocked_subprocess):
|
def test_run_withhout_appium(self, mocked_avd, mocked_open, mocked_subprocess):
|
||||||
with mock.patch('src.app.appium_run') as mocked_appium:
|
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||||
os.environ['APPIUM'] = str(False)
|
os.environ['APPIUM'] = str(False)
|
||||||
app.run()
|
app.run()
|
||||||
self.assertTrue(mocked_avd.called)
|
self.assertTrue(mocked_avd.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
self.assertTrue(mocked_subprocess.called)
|
self.assertTrue(mocked_subprocess.called)
|
||||||
self.assertFalse(mocked_appium.called)
|
self.assertFalse(mocked_appium.called)
|
||||||
|
|
Loading…
Reference in a new issue