Skip to content

Commit

Permalink
Merge pull request #30 from scrapinghub/add-end-to-end-tests
Browse files Browse the repository at this point in the history
Add rudimentary end to end tests
  • Loading branch information
eliasdorneles committed Jun 18, 2015
2 parents 1bcc3b8 + 2cbbbdc commit 5e96cfa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
42 changes: 42 additions & 0 deletions tests/test_end_to_end.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python
# coding=utf-8

import unittest
from click.testing import CliRunner
from shub import tool
import os


@unittest.skipUnless(os.getenv('USING_TOX'),
'End to end tests only run via TOX')
class ShubEndToEndTests(unittest.TestCase):
def setUp(self):
self.runner = CliRunner()

def run_subcmd(self, subcmd):
return self.runner.invoke(tool.cli, [subcmd]).output

def test_usage_is_displayed_if_no_arg_is_provided(self):
output = self.run_subcmd('')
usage_is_displayed = output.startswith('Usage:')
self.assertTrue(usage_is_displayed)

def test_deploy_egg_isnt_broken(self):
output = self.run_subcmd('deploy-egg')
error = 'Unexpected output: %s' % output
self.assertTrue('Missing argument' in output, error)

def test_deploy_reqs_isnt_broken(self):
output = self.run_subcmd('deploy-reqs')
error = 'Unexpected output: %s' % output
self.assertTrue('Missing argument' in output, error)

def test_deploy_isnt_broken(self):
output = self.run_subcmd('deploy')
error = 'Unexpected output: %s' % output
self.assertTrue('requires scrapy' in output, error)

def test_fetch_eggs_isnt_broken(self):
output = self.run_subcmd('fetch-eggs')
error = 'Unexpected output: %s' % output
self.assertTrue('Missing argument' in output, error)
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
envlist = py27, pypy, py33, py34

[testenv]
setenv =
USING_TOX=1

deps =
-rrequirements.txt
mock
pytest
commands =
py.test {posargs:}
py.test -v {posargs:}

0 comments on commit 5e96cfa

Please sign in to comment.