Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: client/site_tests/login_RemoteOwnership/login_RemoteOwnership.py

Issue 6677180: [autotest] More ownership/device policy tests (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2011 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.
4
5 import dbus
6 import dbus.glib
7 import gobject
8 import logging
9 import random
10 import string
11 import os
12
13 from autotest_lib.client.bin import test, utils
14 from autotest_lib.client.common_lib import error
15 from autotest_lib.client.cros import cryptohome, cros_ownership_test, ownership
16
17
18 class login_RemoteOwnership(cros_ownership_test.OwnershipTest):
19 version = 1
20
21 _poldata = 'hooberbloob'
22
23 def setup(self):
24 os.chdir(self.srcdir)
25 utils.make('OUT_DIR=.')
26
27
28 def run_once(self):
29 sm = self.connect_to_session_manager()
30
31 # Initial policy setup.
32 (priv, pub) = ownership.pairgen_as_data()
33 self.push_policy(self.generate_policy(priv, pub, self._poldata), sm)
34
35 # Force re-key the device
36 (priv, pub) = ownership.pairgen_as_data()
37 self.push_policy(self.generate_policy(priv, pub, self._poldata), sm)
38
39 # Rotate key gracefully.
40 username = ''.join(random.sample(string.ascii_uppercase,6)) + "@foo.com"
41 password = ''.join(random.sample(string.ascii_uppercase,6))
42 cryptohome.remove_vault(username)
43 cryptohome.mount_vault(username, password, create=True)
44
45 (new_priv, new_pub) = ownership.pairgen_as_data()
46
47 if not sm.StartSession(username, ''):
48 raise error.TestFail('Could not start session for random user')
49
50 self.push_policy(self.generate_policy(key=new_priv,
51 pubkey=new_pub,
52 policy=self._poldata,
53 old_key=priv),
54 sm)
55
56 if not sm.StopSession(''):
57 raise error.TestFail('Could not stop session for random user')
58
59
60 def cleanup(self):
61 cryptohome.unmount_vault()
62 super(login_RemoteOwnership, self).cleanup()
OLDNEW
« no previous file with comments | « client/site_tests/login_RemoteOwnership/control ('k') | client/site_tests/login_RemoteOwnership/src/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698