def test_do_clear_force_true_error(self): class FakeImage1(): id = 1 name = 'fake_image' is_public = False protected = False status = 'active' size = '1024' min_ram = 512 min_disk = 10 properties = {'a': 'b', 'c': 'd'} created_at = '04.03.2013' owner = 'test' updated_at = '04.03.2013' deleted_at = '04.03.2013' force = True verbose = True class FakeImages(): def __init__(self): self.id = 'test' self.name = 'test_image_name' def list(self): self.list = [FakeImage1(), FakeImage1()] return self.list class FakeClient(): def __init__(self): self.images = FakeImages() test_args = FakeImage1() actual = test_shell.do_clear(FakeClient(), test_args) self.assertEqual(1, actual)
def test_do_clear_force_true(self): class FakeImage1(): def __init__(self): self.id = 1 self.name = 'fake_image' self.is_public = False self.protected = False self.status = 'active' self.size = '1024' self.min_ram = 512 self.min_disk = 10 self.properties = {'a': 'b', 'c': 'd'} self.created_at = '04.03.2013' self.owner = 'test' self.updated_at = '04.03.2013' self.deleted_at = '04.03.2013' self.force = True self.verbose = True def delete(self): pass class FakeImages(): def __init__(self): self.id = 'test' self.name = 'test_image_name' def list(self): self.list = [FakeImage1(), FakeImage1()] return self.list class FakeClient(): def __init__(self): self.images = FakeImages() test_args = FakeImage1() actual = test_shell.do_clear(FakeClient(), test_args) self.assertEqual(0, actual)