Skip to content
Permalink
Browse files

Create a test runner script in python to run unit tests (#321)

  • Loading branch information...
jmathai committed Jul 11, 2019
1 parent 032e24b commit 9e42edfa7656b7c1edc12db9b3e158c1c76db931
Showing with 54 additions and 3 deletions.
  1. +1 −3 .travis.yml
  2. +38 −0 elodie/tests/elodie_test.py
  3. +15 −0 elodie/tests/run_tests.py
@@ -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"
@@ -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
@@ -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)

0 comments on commit 9e42edf

Please sign in to comment.
You can’t perform that action at this time.