Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def add_arguments(self, parser):
nargs=1,
type=str,
)
parser.add_argument(
'base-domain',
help='The base domain set to either `localhost` or something like `devstack.tahoe`',
nargs=1,
type=str,
)

def congrats(self, **kwargs):
"""
Expand Down Expand Up @@ -60,6 +66,7 @@ def handle(self, *args, **options):
raise CommandError('This only works on devstack.')

name = options['name'][0].lower()
base_domain = options['base-domain'][0].lower()
try:
validate_slug(name)
except ValidationError:
Expand All @@ -68,8 +75,8 @@ def handle(self, *args, **options):
if User.objects.filter(username=name).exists():
raise CommandError('User exists with the username: "{}". Please choose another name.'.format(name))

domain = '{}.localhost'.format(name)
site_name = '{}:18000'.format(domain)
domain = '{name}.{base_domain}'.format(name=name, base_domain=base_domain)
site_name = '{domain}:18000'.format(domain=domain)

user = User.objects.create_user(
username=name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_create_devstack_site(self):
Test that `create_devstack_site` and creates the required objects.
"""
with patch.object(Command, 'congrats') as mock_congrats:
call_command('create_devstack_site', self.name)
call_command('create_devstack_site', self.name, 'localhost')

mock_congrats.assert_called_once() # Ensure that congrats message is printed

Expand Down Expand Up @@ -128,8 +128,8 @@ def setUp(self):
self.shall_remain = 'keep'

# This command should be tested above
call_command('create_devstack_site', self.to_be_deleted)
call_command('create_devstack_site', self.shall_remain)
call_command('create_devstack_site', self.to_be_deleted, 'localhost')
call_command('create_devstack_site', self.shall_remain, 'localhost')

def test_create_devstack_site(self):
"""
Expand Down