Skip to content

Commit

Permalink
Merge pull request #17 from tildedave/python_2_6_support
Browse files Browse the repository at this point in the history
Build with 2.6
  • Loading branch information
Dave King committed Mar 24, 2013
2 parents bfe4f2c + f3e530c commit 0918035
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
language: python
python:
# - "2.6"
- "2.6"
- "2.7"
# - "3.2"
# command to install dependencies
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
@@ -1,2 +1,5 @@
nose==1.2.1
unittest2==0.5.1
mock==1.0.1
apache-libcloud>=0.11.4
littlechef==1.5.1
35 changes: 16 additions & 19 deletions test/test_runner.py
@@ -1,4 +1,4 @@
import unittest
import unittest2 as unittest
import mock
from littlechef_rackspace.api import Regions, RackspaceApi
from littlechef_rackspace.commands import RackspaceCreate, RackspaceListImages
Expand Down Expand Up @@ -49,12 +49,11 @@ def test_must_specify_existing_command(self):
def test_list_images_fails_if_configuration_is_not_provided(self):
with mock.patch.multiple("littlechef_rackspace.runner", RackspaceApi=self.api_class,
ChefDeployer=self.deploy_class, RackspaceListImages=self.list_images_class,
abort=self.abort), \
self.assertRaises(AbortException):

r = Runner(options={})
r.main(["list-images"])
self.abort.assert_any_call(FailureMessages.NEED_API_KEY)
abort=self.abort):
with self.assertRaises(AbortException):
r = Runner(options={})
r.main(["list-images"])
self.abort.assert_any_call(FailureMessages.NEED_API_KEY)

def test_list_images_instantiates_api(self):
with mock.patch.multiple("littlechef_rackspace.runner", RackspaceApi=self.api_class,
Expand All @@ -77,21 +76,19 @@ def test_uses_config_settings(self):

def test_create_fails_if_configuration_is_not_provided(self):
r = Runner(options={})
with mock.patch.multiple('littlechef_rackspace.runner', abort=self.abort),\
self.assertRaises(AbortException):

r.main(["create"])
self.abort.assert_any_call(FailureMessages.NEED_API_KEY)
with mock.patch.multiple('littlechef_rackspace.runner', abort=self.abort):
with self.assertRaises(AbortException):
r.main(["create"])
self.abort.assert_any_call(FailureMessages.NEED_API_KEY)


def test_create_fails_if_required_arguments_are_not_provided(self):
with mock.patch.multiple('littlechef_rackspace.runner', abort=self.abort),\
self.assertRaises(AbortException):

self.create_command.validate_args.return_value = False
r = Runner(options={})
r.main("create --username username --key deadbeef --region dfw".split(" "))
self.abort.assert_any_call(FailureMessages.MISSING_REQUIRED_ARGUMENTS)
with mock.patch.multiple('littlechef_rackspace.runner', abort=self.abort):
with self.assertRaises(AbortException):
self.create_command.validate_args.return_value = False
r = Runner(options={})
r.main("create --username username --key deadbeef --region dfw".split(" "))
self.abort.assert_any_call(FailureMessages.MISSING_REQUIRED_ARGUMENTS)

def test_create_instantiates_api_and_deploy_with_default_private_key(self):
with mock.patch.multiple("littlechef_rackspace.runner", RackspaceApi=self.api_class,
Expand Down

0 comments on commit 0918035

Please sign in to comment.