Exemplo n.º 1
0
 def test_install_android_sdk(self, platform):
     """Basic tests for the _install_android_sdk() method."""
     target_android = init_target(self.temp_dir)
     with patch_buildozer_file_exists(
     ) as m_file_exists, patch_buildozer_download() as m_download:
         m_file_exists.return_value = True
         sdk_dir = target_android._install_android_sdk()
     assert m_file_exists.call_args_list == [
         mock.call(target_android.android_sdk_dir)
     ]
     assert m_download.call_args_list == []
     assert sdk_dir.endswith(".buildozer/android/platform/android-sdk")
     with patch_buildozer_file_exists() as m_file_exists, \
             patch_buildozer_download() as m_download, \
             patch_buildozer_file_extract() as m_file_extract, \
             patch_platform(platform):
         m_file_exists.return_value = False
         sdk_dir = target_android._install_android_sdk()
     assert m_file_exists.call_args_list == [
         mock.call(target_android.android_sdk_dir)
     ]
     platform_map = {"linux": "linux", "darwin": "mac"}
     platform = platform_map[platform]
     archive = "commandlinetools-{platform}-6514223_latest.zip".format(
         platform=platform)
     assert m_download.call_args_list == [
         mock.call(
             "https://dl.google.com/android/repository/",
             archive,
             cwd=mock.ANY,
         )
     ]
     assert m_file_extract.call_args_list == [
         mock.call(archive, cwd=mock.ANY)
     ]
     assert sdk_dir.endswith(".buildozer/android/platform/android-sdk")
Exemplo n.º 2
0
 def test_compile_platform(self):
     """Checks the `toolchain build` command is called on the ios requirements."""
     target = init_target(self.temp_dir)
     target.ios_deploy_dir = "/ios/deploy/dir"
     # fmt: off
     with patch_target_ios("get_available_packages") as m_get_available_packages, \
          patch_target_ios("toolchain") as m_toolchain, \
          patch_buildozer_file_exists() as m_file_exists:
         m_get_available_packages.return_value = ["hostpython3", "python3"]
         m_file_exists.return_value = True
         target.compile_platform()
     # fmt: on
     assert m_get_available_packages.call_args_list == [mock.call()]
     assert m_toolchain.call_args_list == [mock.call("build python3")]
     assert m_file_exists.call_args_list == [
         mock.call(target.ios_deploy_dir, "ios-deploy")
     ]