Skip to content

Commit 4f58653

Browse files
author
Matthew Fisher
committed
Merge pull request #901 from deis/remove-username-registry
fix(registry): store apps as appname
2 parents 20646a6 + 29b26ac commit 4f58653

5 files changed

Lines changed: 2 additions & 18 deletions

File tree

api/exceptions.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from __future__ import unicode_literals
66

77
from rest_framework.exceptions import APIException
8-
from rest_framework import status
98

109

1110
class AbstractDeisException(APIException):
@@ -22,10 +21,3 @@ def __init__(self, detail=None):
2221

2322
class Meta:
2423
abstract = True
25-
26-
27-
class UserRegistrationException(AbstractDeisException):
28-
"""
29-
Indicates that there was a problem registering the user.
30-
"""
31-
status_code = status.HTTP_400_BAD_REQUEST

api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def new(self, user, config=None, build=None, summary=None):
432432
owner=user, app=self.app, config=config,
433433
build=build, version=new_version, image=image, summary=summary)
434434
# publish release to registry as new docker image
435-
repository_path = "{}/{}".format(user.username, self.app.id)
435+
repository_path = self.app.id
436436
publish_release(repository_path, config.values, tag)
437437
return release
438438

api/tests/test_auth.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ def test_auth(self):
5656
self.assertFalse(response.data['is_staff'])
5757
self.assertTrue(
5858
self.client.login(username=username, password=password))
59-
# test with len(username) < 4
60-
submit['username'] = 'new'
61-
response = self.client.post(url, json.dumps(submit), content_type='application/json')
62-
self.assertEqual(response.status_code, 400)
6359
# test logout and login
6460
url = '/api/auth/logout/'
6561
response = self.client.post(url, content_type='application/json')

api/tests/test_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_build_hook(self):
106106
url = '/api/hooks/builds'.format(**locals())
107107
body = {'receive_user': 'autotest',
108108
'receive_repo': app_id,
109-
'image': 'registry.local:5000/autotest/{app_id}:v2'.format(**locals())}
109+
'image': 'registry.local:5000/{app_id}:v2'.format(**locals())}
110110
# post the build without a session
111111
self.assertIsNone(self.client.logout())
112112
response = self.client.post(url, json.dumps(body), content_type='application/json')

api/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from rest_framework.response import Response
2323

2424
from api import models, serializers
25-
from .exceptions import UserRegistrationException
2625

2726
from django.conf import settings
2827

@@ -147,9 +146,6 @@ def pre_save(self, obj):
147146
obj.is_active = True
148147
obj.email = User.objects.normalize_email(obj.email)
149148
obj.set_password(obj.password)
150-
# FIXME: move this business logic to the model
151-
if len(obj.username) < 4:
152-
raise UserRegistrationException('username must be >= 4 characters in length')
153149
# Make this first signup an admin / superuser
154150
if not User.objects.filter(is_superuser=True).exists():
155151
obj.is_superuser = obj.is_staff = True

0 commit comments

Comments
 (0)