Merge pull request #492 from coreos-inc/nofreelunch
UI and API fixes for disallowing private repo count abuse
This commit is contained in:
commit
c801965626
12 changed files with 267 additions and 112 deletions
|
@ -317,8 +317,18 @@ class TestGetUserPrivateAllowed(ApiTestCase):
|
|||
|
||||
def test_allowed(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
# Change the subscription of the namespace.
|
||||
self.putJsonResponse(UserPlan, data=dict(plan='personal-30'))
|
||||
|
||||
json = self.getJsonResponse(PrivateRepositories)
|
||||
assert json['privateCount'] >= 6
|
||||
assert not json['privateAllowed']
|
||||
|
||||
# Change the subscription of the namespace.
|
||||
self.putJsonResponse(UserPlan, data=dict(plan='bus-large-30'))
|
||||
|
||||
json = self.getJsonResponse(PrivateRepositories)
|
||||
assert json['privateAllowed']
|
||||
|
||||
|
||||
|
@ -1437,6 +1447,36 @@ class TestUpdateRepo(ApiTestCase):
|
|||
|
||||
class TestChangeRepoVisibility(ApiTestCase):
|
||||
SIMPLE_REPO = ADMIN_ACCESS_USER + '/simple'
|
||||
|
||||
def test_trychangevisibility(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
# Make public.
|
||||
self.postJsonResponse(RepositoryVisibility,
|
||||
params=dict(repository=self.SIMPLE_REPO),
|
||||
data=dict(visibility='public'))
|
||||
|
||||
# Verify the visibility.
|
||||
json = self.getJsonResponse(Repository,
|
||||
params=dict(repository=self.SIMPLE_REPO))
|
||||
|
||||
self.assertEquals(True, json['is_public'])
|
||||
|
||||
# Change the subscription of the namespace.
|
||||
self.putJsonResponse(UserPlan, data=dict(plan='personal-30'))
|
||||
|
||||
# Try to make private.
|
||||
self.postJsonResponse(RepositoryVisibility,
|
||||
params=dict(repository=self.SIMPLE_REPO),
|
||||
data=dict(visibility='private'),
|
||||
expected_code=402)
|
||||
|
||||
# Verify the visibility.
|
||||
json = self.getJsonResponse(Repository,
|
||||
params=dict(repository=self.SIMPLE_REPO))
|
||||
|
||||
self.assertEquals(True, json['is_public'])
|
||||
|
||||
def test_changevisibility(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
|
|
Reference in a new issue