# Path: neckbeard/bin/neckbeard.py
# def run_commands(command, environment, configuration_directory):
#     configuration_directory = os.path.abspath(configuration_directory)
# 
#     loader = _get_and_test_loader(configuration_directory)
#     if loader is None:
#         return 1
# 
#     configuration = _get_and_test_configuration(loader)
#     if configuration is None:
#         return 1
# 
#     if environment is None:
#         # If no environment is given, but there's only one environment
#         # available, just go ahead and use it
#         available_environments = configuration.get_available_environments()
#         if len(available_environments) == 1:
#             environment = available_environments[0]
#         else:
#             logger.critical(
#                 (
#                     "An environment option is required. "
#                     "Available options: %s"
#                 ),
#                 available_environments,
#             )
#             return COMMAND_ERROR_CODES['INVALID_COMMAND_OPTIONS']
# 
#     if command == 'check':
#         do_configuration_check(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
#     elif command == 'up':
#         do_up(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
#     elif command == 'view':
#         do_view(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
# 
# COMMAND_ERROR_CODES = {
#     'INVALID_COMMAND_OPTIONS': 2,
# }


import unittest2
import mock
import boto.exception
from os import path
from neckbeard.bin.neckbeard import run_commands, COMMAND_ERROR_CODES
            'check',
            None,
            configuration_directory=configuration_dir,
        )
        self.assertEqual(
            return_code,
            COMMAND_ERROR_CODES['INVALID_COMMAND_OPTIONS'],
        )

    def test_check(self):
        # Let's use the minimal configs
        configuration_dir = path.join(FIXTURE_CONFIGS_DIR, 'minimal')

        return_code = run_commands('check', 'beta', configuration_dir)
        self.assertEqual(return_code, 0)

    def test_view(self):
        # Let's use the minimal configs
        configuration_dir = path.join(FIXTURE_CONFIGS_DIR, 'minimal')

        with mock.patch(
            'neckbeard.resource_tracker.simpledb.SimpleDB',
            autospec=True,
        ):
            # Until we can either mock out boto with a version of moto that
            # supports python 2.6 or we create a local/mockable
            # ResourceTracker, we can only test that we try to authenticate
            # with boto and then break. That counts as passing, for now.
            self.assertRaises(
                boto.exception.NoAuthHandlerFound,

# Path: neckbeard/bin/neckbeard.py
# def run_commands(command, environment, configuration_directory):
#     configuration_directory = os.path.abspath(configuration_directory)
# 
#     loader = _get_and_test_loader(configuration_directory)
#     if loader is None:
#         return 1
# 
#     configuration = _get_and_test_configuration(loader)
#     if configuration is None:
#         return 1
# 
#     if environment is None:
#         # If no environment is given, but there's only one environment
#         # available, just go ahead and use it
#         available_environments = configuration.get_available_environments()
#         if len(available_environments) == 1:
#             environment = available_environments[0]
#         else:
#             logger.critical(
#                 (
#                     "An environment option is required. "
#                     "Available options: %s"
#                 ),
#                 available_environments,
#             )
#             return COMMAND_ERROR_CODES['INVALID_COMMAND_OPTIONS']
# 
#     if command == 'check':
#         do_configuration_check(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
#     elif command == 'up':
#         do_up(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
#     elif command == 'view':
#         do_view(
#             configuration_directory,
#             environment,
#             configuration,
#         )
#         return 0
# 
# COMMAND_ERROR_CODES = {
#     'INVALID_COMMAND_OPTIONS': 2,
# }


# Path: neckbeard/tests/bin/test_neckbeard.py
import unittest2
import mock
import boto.exception
from os import path
from neckbeard.bin.neckbeard import run_commands, COMMAND_ERROR_CODES

            'check',
            None,
            configuration_directory=configuration_dir,
        )
        self.assertEqual(
            return_code,
            COMMAND_ERROR_CODES['INVALID_COMMAND_OPTIONS'],
        )

    def test_check(self):
        # Let's use the minimal configs
        configuration_dir = path.join(FIXTURE_CONFIGS_DIR, 'minimal')

        return_code = run_commands('check', 'beta', configuration_dir)
        self.assertEqual(return_code, 0)

    def test_view(self):
        # Let's use the minimal configs
        configuration_dir = path.join(FIXTURE_CONFIGS_DIR, 'minimal')

        with mock.patch(
            'neckbeard.resource_tracker.simpledb.SimpleDB',
            autospec=True,
        ):
            # Until we can either mock out boto with a version of moto that
            # supports python 2.6 or we create a local/mockable
            # ResourceTracker, we can only test that we try to authenticate
            # with boto and then break. That counts as passing, for now.
            self.assertRaises(
                boto.exception.NoAuthHandlerFound,

                run_commands,