aboutsummaryrefslogtreecommitdiff
path: root/client/common_lib/lsbrelease_utils_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/common_lib/lsbrelease_utils_unittest.py')
-rwxr-xr-xclient/common_lib/lsbrelease_utils_unittest.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/client/common_lib/lsbrelease_utils_unittest.py b/client/common_lib/lsbrelease_utils_unittest.py
index 4a2e97760c..6b0dbbdb31 100755
--- a/client/common_lib/lsbrelease_utils_unittest.py
+++ b/client/common_lib/lsbrelease_utils_unittest.py
@@ -1,10 +1,10 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the lsbrelease_utils module."""
-
+import os
import unittest
import common
@@ -25,7 +25,7 @@ CHROMEOS_RELEASE_PATCH_NUMBER=0
CHROMEOS_RELEASE_TRACK=testimage-channel
CHROMEOS_RELEASE_DESCRIPTION=9641.0.0 (Official Build) dev-channel guado_moblab test
CHROMEOS_RELEASE_BUILD_TYPE=Official Build
-CHROMEOS_RELEASE_NAME=Chrome OS
+CHROMEOS_RELEASE_NAME=ChromeOS
CHROMEOS_RELEASE_VERSION=9641.0.0
CHROMEOS_AUSERVER=https://tools.google.com/service/update2
"""
@@ -43,7 +43,7 @@ CHROMEOS_RELEASE_PATCH_NUMBER=0
CHROMEOS_RELEASE_TRACK=testimage-channel
CHROMEOS_RELEASE_DESCRIPTION=9641.0.0 (Official Build) dev-channel link test
CHROMEOS_RELEASE_BUILD_TYPE=Official Build
-CHROMEOS_RELEASE_NAME=Chrome OS
+CHROMEOS_RELEASE_NAME=ChromeOS
CHROMEOS_RELEASE_VERSION=9641.0.0
CHROMEOS_AUSERVER=https://tools.google.com/service/update2
"""
@@ -62,7 +62,7 @@ CHROMEOS_RELEASE_PATCH_NUMBER=0
CHROMEOS_RELEASE_TRACK=testimage-channel
CHROMEOS_RELEASE_DESCRIPTION=9641.0.0 (Official Build) dev-channel gale test
CHROMEOS_RELEASE_BUILD_TYPE=Official Build
-CHROMEOS_RELEASE_NAME=Chrome OS
+CHROMEOS_RELEASE_NAME=ChromeOS
CHROMEOS_RELEASE_VERSION=9641.0.0
CHROMEOS_AUSERVER=https://tools.google.com/service/update2
"""
@@ -82,7 +82,7 @@ CHROMEOS_RELEASE_PATCH_NUMBER=0
CHROMEOS_RELEASE_TRACK=testimage-channel
CHROMEOS_RELEASE_DESCRIPTION=9641.0.0 (Official Build) dev-channel whirlwind test
CHROMEOS_RELEASE_BUILD_TYPE=Official Build
-CHROMEOS_RELEASE_NAME=Chrome OS
+CHROMEOS_RELEASE_NAME=ChromeOS
CHROMEOS_RELEASE_VERSION=9641.0.0
CHROMEOS_AUSERVER=https://tools.google.com/service/update2
"""
@@ -111,19 +111,17 @@ class LsbreleaseUtilsTestCase(unittest.TestCase):
self.assertTrue(lsbrelease_utils.is_jetstream(
_WHIRLWIND_LSB_RELEASE_REDACTED))
- def test_is_moblab_with_empty_lsbrelease(self):
- """is_moblab correctly validates trivial lsb-release information."""
- self.assertFalse(lsbrelease_utils.is_moblab(''))
-
- def test_is_moblab_with_link_lsbrelease(self):
+ def test_is_moblab_with_sbrelease(self):
"""is_moblab correctly validates the contents from some other board."""
- self.assertFalse(lsbrelease_utils.is_moblab(
- _LINK_LSB_RELEASE_REDACTED))
+ environ_store = os.environ
+ os.environ = []
+ self.assertFalse(lsbrelease_utils.is_moblab())
+ os.environ = environ_store
def test_is_moblab_with_moblab_lsbrelease(self):
"""is_moblab correctly validates the contents from a moblab device."""
- self.assertTrue(lsbrelease_utils.is_moblab(
- _GUADO_MOBLAB_LSB_RELEASE_REDACTED))
+ os.environ['MOBLAB'] = "1"
+ self.assertTrue(lsbrelease_utils.is_moblab())
def test_get_chromeos_release_version(self):
"""Test helper function."""