예제 #1
0
class TestWaitCommand(unittest.TestCase):
    def setUp(self):
        self.model = WaiterModel({
            'version': 2,
            'waiters': {
                'Foo': {
                    'operation': 'foo',
                    'maxAttempts': 1,
                    'delay': 1,
                    'acceptors': [],
                }
            }
        })
        self.service_object = mock.Mock()
        self.cmd = WaitCommand(self.model, self.service_object)

    def test_passes_on_lineage(self):
        child_cmd = self.cmd.subcommand_table['foo']
        self.assertEqual(len(child_cmd.lineage), 2)
        self.assertEqual(child_cmd.lineage[0], self.cmd)
        self.assertIsInstance(child_cmd.lineage[1], WaiterStateCommand)

    def test_run_main_error(self):
        self.parsed_args = mock.Mock()
        self.parsed_args.subcommand = None
        with self.assertRaises(ValueError):
            self.cmd._run_main(self.parsed_args, None)
예제 #2
0
class TestWaitCommand(unittest.TestCase):
    def setUp(self):
        self.model = WaiterModel({
            'version': 2,
            'waiters': {
                'Foo': {
                    'operation': 'foo', 'maxAttempts': 1, 'delay': 1,
                    'acceptors': [],
                }
            }
        })
        self.service_object = mock.Mock()
        self.cmd = WaitCommand(self.model, self.service_object)

    def test_passes_on_lineage(self):
        child_cmd = self.cmd.subcommand_table['foo']
        self.assertEqual(len(child_cmd.lineage), 2)
        self.assertEqual(child_cmd.lineage[0], self.cmd) 
        self.assertIsInstance(child_cmd.lineage[1], WaiterStateCommand)

    def test_run_main_error(self):
        self.parsed_args = mock.Mock()
        self.parsed_args.subcommand = None
        with self.assertRaises(ValueError):
            self.cmd._run_main(self.parsed_args, None)
예제 #3
0
class TestWaitCommand(unittest.TestCase):
    def setUp(self):
        self.model = WaiterModel({
            'version': 2,
            'waiters': {
                'Foo': {
                    'operation': 'foo', 'maxAttempts': 1, 'delay': 1,
                    'acceptors': [],
                }
            }
        })
        self.service_object = mock.Mock()
        self.cmd = WaitCommand(self.model, self.service_object)

    def test_run_main_error(self):
        self.parsed_args = mock.Mock()
        self.parsed_args.subcommand = None
        with self.assertRaises(ValueError):
            self.cmd._run_main(self.parsed_args, None)
예제 #4
0
class TestWaitCommand(unittest.TestCase):
    def setUp(self):
        self.session = mock.Mock()
        self.model = WaiterModel(
            {"version": 2, "waiters": {"Foo": {"operation": "foo", "maxAttempts": 1, "delay": 1, "acceptors": []}}}
        )
        self.service_model = mock.Mock()
        self.cmd = WaitCommand(self.session, self.model, self.service_model)

    def test_passes_on_lineage(self):
        child_cmd = self.cmd.subcommand_table["foo"]
        self.assertEqual(len(child_cmd.lineage), 2)
        self.assertEqual(child_cmd.lineage[0], self.cmd)
        self.assertIsInstance(child_cmd.lineage[1], WaiterStateCommand)

    def test_run_main_error(self):
        self.parsed_args = mock.Mock()
        self.parsed_args.subcommand = None
        with self.assertRaises(ValueError):
            self.cmd._run_main(self.parsed_args, None)