diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-27 12:57:03 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-03-05 23:32:31 +0100 |
| commit | f891e9b9e9f0df27c237d7577e85c4e18fb3b19f (patch) | |
| tree | 663cc236ce8b71f75c75f3faa1e25da6ffffa4f3 | |
| parent | 5605ba9037597aeb8577c8a068e19ca1854bb997 (diff) | |
| download | mullvadvpn-f891e9b9e9f0df27c237d7577e85c4e18fb3b19f.tar.xz mullvadvpn-f891e9b9e9f0df27c237d7577e85c4e18fb3b19f.zip | |
Fix tests
| -rw-r--r-- | installer-downloader/src/environment.rs | 4 | ||||
| -rw-r--r-- | installer-downloader/tests/controller.rs | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/installer-downloader/src/environment.rs b/installer-downloader/src/environment.rs index 4b17575912..f2bb691d5a 100644 --- a/installer-downloader/src/environment.rs +++ b/installer-downloader/src/environment.rs @@ -2,9 +2,11 @@ use mullvad_update::version::VersionArchitecture; /// The environment consists of globals and/or constants which need to be computed at runtime. pub struct Environment { - pub architecture: mullvad_update::format::Architecture, + pub architecture: Architecture, } +pub type Architecture = mullvad_update::format::Architecture; + pub enum Error { /// Failed to get the host's CPU architecture. Arch, diff --git a/installer-downloader/tests/controller.rs b/installer-downloader/tests/controller.rs index aa74c308b8..3c7c56a3c1 100644 --- a/installer-downloader/tests/controller.rs +++ b/installer-downloader/tests/controller.rs @@ -9,6 +9,7 @@ use insta::assert_yaml_snapshot; use installer_downloader::controller::AppController; use installer_downloader::delegate::{AppDelegate, AppDelegateQueue, ErrorMessage}; +use installer_downloader::environment::{Architecture, Environment}; use installer_downloader::temp::DirectoryProvider; use installer_downloader::ui_downloader::UiAppDownloaderParameters; use mullvad_update::api::VersionInfoProvider; @@ -34,6 +35,10 @@ static FAKE_VERSION: LazyLock<VersionInfo> = LazyLock::new(|| VersionInfo { beta: None, }); +const FAKE_ENVIRONMENT: Environment = Environment { + architecture: Architecture::X86, +}; + #[async_trait::async_trait] impl VersionInfoProvider for FakeVersionInfoProvider { async fn get_version_info(&self, _params: VersionParameters) -> anyhow::Result<VersionInfo> { @@ -357,6 +362,7 @@ async fn test_fetch_version() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // The app should start out by fetching the current app version @@ -380,6 +386,7 @@ async fn test_download() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info @@ -425,6 +432,7 @@ async fn test_failed_verification() { AppController::initialize::<_, FakeAppDownloaderVerifyFail, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info @@ -462,6 +470,7 @@ async fn test_failed_directory_creation() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<false>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info |
