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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: client/site_tests/login_RemoteOwnership/login_RemoteOwnership.py
diff --git a/client/site_tests/login_RemoteOwnership/login_RemoteOwnership.py b/client/site_tests/login_RemoteOwnership/login_RemoteOwnership.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee0bfe8784b6aff76f04da4a9a1d86f747228e07
--- /dev/null
+++ b/client/site_tests/login_RemoteOwnership/login_RemoteOwnership.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import dbus
+import dbus.glib
+import gobject
+import logging
+import random
+import string
+import os
+
+from autotest_lib.client.bin import test, utils
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.cros import cryptohome, cros_ownership_test, ownership
+
+
+class login_RemoteOwnership(cros_ownership_test.OwnershipTest):
+ version = 1
+
+ _poldata = 'hooberbloob'
+
+ def setup(self):
+ os.chdir(self.srcdir)
+ utils.make('OUT_DIR=.')
+
+
+ def run_once(self):
+ sm = self.connect_to_session_manager()
+
+ # Initial policy setup.
+ (priv, pub) = ownership.pairgen_as_data()
+ self.push_policy(self.generate_policy(priv, pub, self._poldata), sm)
+
+ # Force re-key the device
+ (priv, pub) = ownership.pairgen_as_data()
+ self.push_policy(self.generate_policy(priv, pub, self._poldata), sm)
+
+ # Rotate key gracefully.
+ username = ''.join(random.sample(string.ascii_uppercase,6)) + "@foo.com"
+ password = ''.join(random.sample(string.ascii_uppercase,6))
+ cryptohome.remove_vault(username)
+ cryptohome.mount_vault(username, password, create=True)
+
+ (new_priv, new_pub) = ownership.pairgen_as_data()
+
+ if not sm.StartSession(username, ''):
+ raise error.TestFail('Could not start session for random user')
+
+ self.push_policy(self.generate_policy(key=new_priv,
+ pubkey=new_pub,
+ policy=self._poldata,
+ old_key=priv),
+ sm)
+
+ if not sm.StopSession(''):
+ raise error.TestFail('Could not stop session for random user')
+
+
+ def cleanup(self):
+ cryptohome.unmount_vault()
+ super(login_RemoteOwnership, self).cleanup()
« 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