diff --git a/.travis.yml b/.travis.yml index eb852d8..894bfa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ before_install: install: - "pip install -r elodie/tests/requirements.txt" - "pip install coveralls" -# command to run tests -# test mapquest key before_script: - "mkdir ~/.elodie" - "sed 's/your-api-key-goes-here/x8wQLqGhW7qK3sFpjYtVTogVtoMK0S8s/g' config.ini-sample > ~/.elodie/config.ini" @@ -28,4 +26,4 @@ before_script: after_success: - "coveralls" script: - - "nosetests --with-coverage --cover-package=elodie -w elodie/tests" + - "./elodie/tests/run_tests.py -w elodie/tests --with-coverage --cover-package=elodie" diff --git a/elodie/tests/elodie_test.py b/elodie/tests/elodie_test.py index c05a8c8..ddbdf0b 100644 --- a/elodie/tests/elodie_test.py +++ b/elodie/tests/elodie_test.py @@ -605,6 +605,44 @@ def test_verify_error(): assert origin in result.output, result.output assert 'Error 1' in result.output, result.output +# @mock.patch('elodie.config.config_file', '%s/config.ini-cli-batch-plugin-googlephotos' % gettempdir()) +# def test_cli_batch_plugin_googlephotos(): +# auth_file = helper.get_file('plugins/googlephotos/auth_file.json') +# secrets_file = helper.get_file('plugins/googlephotos/secrets_file.json') +# config_string = """ +# [Plugins] +# plugins=GooglePhotos + +# [PluginGooglePhotos] +# auth_file={} +# secrets_file={} +# """ +# config_string_fmt = config_string.format( +# auth_file, +# secrets_file +# ) +# with open('%s/config.ini-cli-batch-plugin-googlephotos' % gettempdir(), 'w') as f: +# f.write(config_string_fmt) + +# if hasattr(load_config, 'config'): +# del load_config.config + +# final_file_path_1 = helper.get_file('plain.jpg') +# final_file_path_2 = helper.get_file('no-exif.jpg') +# sample_metadata_1 = Photo(final_file_path_1).get_metadata() +# sample_metadata_2 = Photo(final_file_path_2).get_metadata() +# gp = GooglePhotos() +# gp.after('', '', final_file_path_1, sample_metadata_1) +# gp.after('', '', final_file_path_2, sample_metadata_1) + +# if hasattr(load_config, 'config'): +# del load_config.config + +# runner = CliRunner() +# result = runner.invoke(elodie._batch) +# assert "elodie/elodie/tests/files/plain.jpg uploaded successfully.\"}\n" in result.output, result.output +# assert "elodie/elodie/tests/files/no-exif.jpg uploaded successfully.\"}\n" in result.output, result.output + def test_cli_debug_import(): runner = CliRunner() # import diff --git a/elodie/tests/run_tests.py b/elodie/tests/run_tests.py new file mode 100755 index 0000000..1b3c88e --- /dev/null +++ b/elodie/tests/run_tests.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import nose +import os +import sys + +if __name__ == "__main__": + test_directory = os.path.dirname(os.path.abspath(__file__)) + test_argv = sys.argv + test_argv.append('--verbosity=2') + result = nose.run(argv=test_argv) + if(result): + sys.exit(0) + else: + sys.exit(1)