def test_configure_bad_cloud_choice(self): aws = ["bad", "0"] def _l_get_input(prompt): return aws.pop() func = dcm.agent.cmd.configure._get_input try: dcm.agent.cmd.configure._get_input = _l_get_input cloud = configure.select_cloud() finally: dcm.agent.cmd.configure._get_input = func self.assertEqual(cloud.lower(), configure.cloud_choices[0].lower())
def test_configure_cloud_choice(self): cloud_choice = "0" with mock.patch('dcm.agent.cmd.configure._get_input'): configure._get_input.return_value = cloud_choice cloud = configure.select_cloud() self.assertEqual(cloud.lower(), configure.cloud_choices[0].lower())