'Make sure Zappa uses settings in the proper order: JSON, TOML, YAML.'

def test_settings_extension(self):

    tempdir = tempfile.mkdtemp(prefix='zappa-test-settings')
    shutil.copy('tests/test_one_env.json', (tempdir + '/zappa_settings.json'))
    shutil.copy('tests/test_settings.yml', (tempdir + '/zappa_settings.yml'))
    shutil.copy('tests/test_settings.toml', (tempdir + '/zappa_settings.toml'))
    orig_cwd = os.getcwd()
    os.chdir(tempdir)
    try:
        zappa_cli = ZappaCLI()
        self.assertEqual(zappa_cli.get_json_or_yaml_settings(), 'zappa_settings.json')
        zappa_cli.load_settings_file()
        self.assertIn('lonely', zappa_cli.zappa_settings)
        os.unlink('zappa_settings.json')
        self.assertEqual(zappa_cli.get_json_or_yaml_settings(), 'zappa_settings.toml')
        zappa_cli.load_settings_file()
        self.assertIn('ttt888', zappa_cli.zappa_settings)
        self.assertNotIn('devor', zappa_cli.zappa_settings)
        os.unlink('zappa_settings.toml')
        self.assertEqual(zappa_cli.get_json_or_yaml_settings(), 'zappa_settings.yml')
        zappa_cli.load_settings_file()
        self.assertIn('ttt888', zappa_cli.zappa_settings)
        self.assertIn('devor', zappa_cli.zappa_settings)
        os.unlink('zappa_settings.yml')
        self.assertRaises(ClickException, zappa_cli.get_json_or_yaml_settings)
    finally:
        os.chdir(orig_cwd)
        shutil.rmtree(tempdir)
