1#!/usr/bin/python2 2# Copyright 2017 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import mox 7import unittest 8 9import common 10from autotest_lib.client.bin import utils 11from autotest_lib.site_utils.lxc import container_bucket 12 13 14class ContainerBucketTests(mox.MoxTestBase): 15 """Unit tests for the ContainerBucket class.""" 16 17 def testForceDestruction(self): 18 """Verifies that the force destruction logic produces the right cmd. 19 """ 20 self.mox.StubOutWithMock(utils, 'run') 21 utils.run('sudo lxc-destroy -P ' 22 '/usr/local/autotest/containers -n nonexistent-name -f -s', 23 ignore_status=mox.IgnoreArg(), 24 timeout=mox.IgnoreArg() 25 ).AndReturn(mox.MockAnything()) 26 self.mox.ReplayAll() 27 bucket = container_bucket.ContainerBucket( 28 container_factory=mox.MockAnything()) 29 bucket.scrub_container_location("nonexistent-name") 30 self.mox.VerifyAll() 31 32 33if __name__ == '__main__': 34 unittest.main() 35