- Fix tests to not hit remote Redis endpoint

- Fix convert organization to allow admin email address, in addition to username
- Add test for the above
This commit is contained in:
Joseph Schorr 2014-07-08 18:19:13 -04:00
parent 3ebdf2c062
commit b0c4f5b2f5
4 changed files with 32 additions and 10 deletions

View file

@ -53,6 +53,8 @@ READ_ACCESS_USER = 'reader'
ADMIN_ACCESS_USER = 'devtable'
PUBLIC_USER = 'public'
ADMIN_ACCESS_EMAIL = 'jschorr@devtable.com'
ORG_REPO = 'orgrepo'
ORGANIZATION = 'buynlarge'
@ -274,6 +276,28 @@ class TestConvertToOrganization(ApiTestCase):
self.assertEquals(True, json['is_admin'])
def test_convert_via_email(self):
self.login(READ_ACCESS_USER)
json = self.postJsonResponse(ConvertToOrganization,
data={'adminUser': ADMIN_ACCESS_EMAIL,
'adminPassword': 'password',
'plan': 'free'})
self.assertEqual(True, json['success'])
# Verify the organization exists.
organization = model.get_organization(READ_ACCESS_USER)
assert organization is not None
# Verify the admin user is the org's admin.
self.login(ADMIN_ACCESS_USER)
json = self.getJsonResponse(Organization,
params=dict(orgname=READ_ACCESS_USER))
self.assertEquals(READ_ACCESS_USER, json['name'])
self.assertEquals(True, json['is_admin'])
class TestChangeUserDetails(ApiTestCase):
def test_changepassword(self):
self.login(READ_ACCESS_USER)
@ -982,12 +1006,6 @@ class TestRepoBuilds(ApiTestCase):
self.assertEquals(status_json, build)
# Check the logs.
logs_json = self.getJsonResponse(RepositoryBuildLogs,
params=dict(repository=ADMIN_ACCESS_USER + '/building', build_uuid=build['id']))
assert 'logs' in logs_json
class TestRequestRepoBuild(ApiTestCase):
def test_requestrepobuild(self):
self.login(ADMIN_ACCESS_USER)