• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4from autotest_lib.client.common_lib import error
5from autotest_lib.client.cros import cryptohome
6from autotest_lib.client.cros.enterprise import enterprise_policy_base
7
8
9class policy_DeviceEphemeralUsersEnabled(
10        enterprise_policy_base.EnterprisePolicyTest):
11    """Test for the DeviceEphemeralUsersEnabled policy."""
12    version = 1
13    _POLICY = 'DeviceEphemeralUsersEnabled'
14
15    def verify_permanent_vault(self, case):
16        if case and cryptohome.is_permanent_vault_mounted(
17            user=enterprise_policy_base.USERNAME):
18                raise error.TestFail(
19                    'User should not be permanently vaulted in '
20                    'Ephemeral mode.')
21
22        if not case:
23            cryptohome.is_permanent_vault_mounted(
24                user=enterprise_policy_base.USERNAME, allow_fail=True)
25
26    def run_once(self, case):
27        """
28        Entry point of this test.
29
30        @param case: True, False, or None for the value of the policy.
31
32        """
33        self.setup_case(device_policies={self._POLICY: case}, enroll=True)
34        self.verify_permanent_vault(case)