mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-30 11:12:16 +00:00
Fixed issue with device / skin for android version < 5.0
This commit is contained in:
@@ -6,6 +6,8 @@ import mock
|
||||
from src import android
|
||||
|
||||
|
||||
@mock.patch('os.symlink')
|
||||
@mock.patch('subprocess.check_call')
|
||||
class TestAvd(TestCase):
|
||||
"""Unit test class to test method create_avd."""
|
||||
|
||||
@@ -16,15 +18,24 @@ class TestAvd(TestCase):
|
||||
self.avd_name = 'nexus_5_5.0'
|
||||
self.api_level = 21
|
||||
|
||||
@mock.patch('os.symlink')
|
||||
@mock.patch('subprocess.check_call')
|
||||
def test_avd_creation(self, mocked_sys_link, mocked_suprocess):
|
||||
def test_avd_creation_x86_64(self, mocked_sys_link, mocked_suprocess):
|
||||
with mock.patch('os.listdir') as mocked_list_dir:
|
||||
mocked_list_dir.return_value = ['file1', 'file2']
|
||||
self.assertFalse(mocked_list_dir.called)
|
||||
self.assertFalse(mocked_sys_link.called)
|
||||
self.assertFalse(mocked_suprocess.called)
|
||||
android.create_avd(self.android_path, self.device, self.skin, self.avd_name, self.api_level)
|
||||
android.create_avd(self.android_path, self.device, self.skin, self.avd_name, android.TYPE_X86_64,
|
||||
self.api_level)
|
||||
self.assertTrue(mocked_list_dir.called)
|
||||
self.assertTrue(mocked_sys_link.called)
|
||||
self.assertTrue(mocked_suprocess.called)
|
||||
|
||||
def test_avd_creation_x86(self, mocked_sys_link, mocked_suprocess):
|
||||
with mock.patch('os.listdir') as mocked_list_dir:
|
||||
mocked_list_dir.return_value = ['file1', 'file2']
|
||||
self.assertFalse(mocked_list_dir.called)
|
||||
self.assertFalse(mocked_sys_link.called)
|
||||
self.assertFalse(mocked_suprocess.called)
|
||||
android.create_avd(self.android_path, self.device, self.skin, self.avd_name, android.TYPE_X86,
|
||||
self.api_level)
|
||||
self.assertFalse(mocked_list_dir.called)
|
||||
|
||||
Reference in New Issue
Block a user