# Path: caravan/tests/util.py
# def mock_args(args):
#     return mock.patch('sys.argv', ['PROG'] + args)
# 
# Path: caravan/commands/domain_list.py
# class Command(BaseCommand):
# 
#     description = 'List domains'
# 
#     def setup_arguments(self, parser):
#         parser.add_argument('--deprecated',
#                             dest='registration_status',
#                             action='store_const',
#                             const='DEPRECATED',
#                             default='REGISTERED')
# 
#     def run(self):
#         response = run_swf_command(
#             'list_domains',
#             registrationStatus=self.args.registration_status
#             )
# 
#         return response['domainInfos']


import unittest
import json
import httpretty
from abduct import captured, out, err
from caravan.tests.util import mock_args
from caravan.commands.domain_list import Command
    args += additional_args
    with captured(out(), err()) as (stdout, stderr):
        with mock_args(args):
            Command.main()

    return stdout, stderr


class Test(unittest.TestCase):

    @httpretty.activate
    def test_nominal(self):
        httpretty_register()
        stdout, stderr = run_command([])
        request = httpretty.last_request()

        self.assertEqual(request.headers.get('x-amz-target'),
                         'SimpleWorkflowService.ListDomains')

        expected = {
            "registrationStatus": "REGISTERED",
            }
        self.assertEqual(json.loads(request.parsed_body), expected)

        self.assertIn('867530901', stdout.getvalue())
        self.assertIn('music', stdout.getvalue())

    @httpretty.activate
    def test_registration_status(self):
        httpretty_register()

# Path: caravan/tests/util.py
# def mock_args(args):
#     return mock.patch('sys.argv', ['PROG'] + args)
# 
# Path: caravan/commands/domain_list.py
# class Command(BaseCommand):
# 
#     description = 'List domains'
# 
#     def setup_arguments(self, parser):
#         parser.add_argument('--deprecated',
#                             dest='registration_status',
#                             action='store_const',
#                             const='DEPRECATED',
#                             default='REGISTERED')
# 
#     def run(self):
#         response = run_swf_command(
#             'list_domains',
#             registrationStatus=self.args.registration_status
#             )
# 
#         return response['domainInfos']


# Path: caravan/tests/commands/test_domain_list.py
import unittest
import json
import httpretty
from abduct import captured, out, err
from caravan.tests.util import mock_args
from caravan.commands.domain_list import Command

    args += additional_args
    with captured(out(), err()) as (stdout, stderr):
        with mock_args(args):
            Command.main()

    return stdout, stderr


class Test(unittest.TestCase):

    @httpretty.activate
    def test_nominal(self):
        httpretty_register()
        stdout, stderr = run_command([])
        request = httpretty.last_request()

        self.assertEqual(request.headers.get('x-amz-target'),
                         'SimpleWorkflowService.ListDomains')

        expected = {
            "registrationStatus": "REGISTERED",
            }
        self.assertEqual(json.loads(request.parsed_body), expected)

        self.assertIn('867530901', stdout.getvalue())
        self.assertIn('music', stdout.getvalue())

    @httpretty.activate
    def test_registration_status(self):
        httpretty_register()

        stdout, stderr = run_command(['--deprecated'])