def form_database_object(self): create_db = self.app.pargs.database username = self.app.pargs.db_user password = self.app.pargs.db_pass engine = self.app.pargs.db_engine size = self.app.pargs.db_size instance = self.app.pargs.db_instance version = self.app.pargs.db_version if create_db or username or password or engine or size \ or instance or version: db_object = dict() if not username: io.echo() username = io.get_input(prompts['rds.username'], default='ebroot') if not password: password = io.get_pass(prompts['rds.password']) db_object['username'] = username db_object['password'] = password db_object['engine'] = engine db_object['size'] = str(size) if size else None db_object['instance'] = instance db_object['version'] = version return db_object else: return {}
def test_get_pass__gets_right_first_time(self, get_pass_mock): get_pass_mock.side_effect = [ 'password', 'password', ] self.assertEqual('password', io.get_pass(''))
def test_get_pass__gets_right_second_time(self, get_pass_mock): get_pass_mock.side_effect = [ 'password', 'passwor∂', 'password', 'password', ] self.assertEqual('password', io.get_pass('')) self.assertEqual(4, get_pass_mock.call_count)