def test_get_update_status_versions_is_none(): """BaseUpdater.versions may be set to None, before NXDRIVE-1682.""" # No version current, server, channel, action_required, new = "3.1.2", "", "release", "", "" action, version = get_update_status(current, None, channel, server, Login.NONE) assert action == action_required assert version == new
def test_get_update_status_centralized_channel_wrong_server(): """Test the Centralized channel when the desired version is not compatible with the server.""" Options.client_version = "4.2.1" assert Options.client_version == "4.2.1" action, version = get_update_status("4.3.4", VERSIONS, "centralized", "10.11", Login.NEW) assert action == UPDATE_STATUS_INCOMPATIBLE_SERVER assert version == "4.2.1"
def test_get_update_status_centralized_channel(current, desired, action_required, new): """Test the Centralized channel.""" Options.client_version = desired assert Options.client_version == desired action, version = get_update_status( current, VERSIONS, "centralized", "10.12", Login.NEW ) assert action == action_required assert version == new
def test_get_update_status_centralized_channel_without_client_version(): """Test the Centralized channel when no client_version is set, it should fall back on the release channel. """ assert Options.client_version is None action, version = get_update_status("4.0.1", VERSIONS, "centralized", "10.15", Login.NEW) assert action == UPDATE_STATUS_UPDATE_AVAILABLE assert version == "4.2.1"
def test_get_update_status_centralized_channel_client_version_from_other_channel(): """Test the Centralized channel with a client_version from a channel other than release.""" Options.client_version = "4.3.4" action, version = get_update_status( "4.0.3.12", VERSIONS, "centralized", "10.12", Login.NEW ) # As the client_version is set, it is allowed to update to another channel (here alpha -> beta) assert action == UPDATE_STATUS_UPDATE_AVAILABLE assert version == "4.3.4"
def test_get_update_status_centralized_channel_wrong_client_version(): """Test the Centralized channel with a client_version too low.""" # Must be >= 4.2.0 Options.client_version = "4.0.3.12" # The options is not updated, protected by the option's callback assert Options.client_version is None action, version = get_update_status("4.3.4", VERSIONS, "centralized", "10.12", Login.NEW) # As the client_version is not set, it falls back to the release channel. # The latest release is 4.2.0 (4.3.4 is beta). # As the version in use is from the beta channel, the user is asked # to either downgrade to the release channel or continue using that beta channel. assert action == UPDATE_STATUS_WRONG_CHANNEL assert version == "4.2.0"
def test_get_update_status(current, server, channel, action_required, new): """get_update_status calls get_latest_version and get_compatible_versions, 2 tests in one!""" action, version = get_update_status(current, VERSIONS, channel, server, Login.NEW) assert action == action_required assert version == new
def test_get_update_status(current, server, nature, action_required, new): """get_update_status calls get_latest_version and get_compatible_versions, 2 tests in one!""" action, version = get_update_status(current, VERSIONS, nature, server, Login.NEW) assert action == action_required assert version == new