tests: star security tests
This commit is contained in:
parent
2914a5da96
commit
35a2414d85
2 changed files with 54 additions and 6 deletions
|
@ -26,7 +26,7 @@ from endpoints.api.repoemail import RepositoryAuthorizedEmail
|
|||
from endpoints.api.repositorynotification import RepositoryNotification, RepositoryNotificationList
|
||||
from endpoints.api.user import (PrivateRepositories, ConvertToOrganization, Recovery, Signout,
|
||||
Signin, User, UserAuthorizationList, UserAuthorization, UserNotification,
|
||||
VerifyUser, DetachExternal)
|
||||
VerifyUser, DetachExternal, StarredRepositoryList, StarredRepository)
|
||||
from endpoints.api.repotoken import RepositoryToken, RepositoryTokenList
|
||||
from endpoints.api.prototype import PermissionPrototype, PermissionPrototypeList
|
||||
from endpoints.api.logs import UserLogs, OrgLogs, RepositoryLogs
|
||||
|
@ -132,6 +132,58 @@ class TestFindRepositories(ApiTestCase):
|
|||
|
||||
|
||||
|
||||
class TestUserStarredRepositoryList(ApiTestCase):
|
||||
def setUp(self):
|
||||
ApiTestCase.setUp(self)
|
||||
self._set_url(StarredRepositoryList)
|
||||
|
||||
def test_get_anonymous(self):
|
||||
self._run_test('GET', 401, None, None)
|
||||
|
||||
def test_get_freshuser(self):
|
||||
self._run_test('GET', 200, 'freshuser', None)
|
||||
|
||||
def test_get_reader(self):
|
||||
self._run_test('GET', 200, 'reader', None)
|
||||
|
||||
def test_get_devtable(self):
|
||||
self._run_test('GET', 200, 'devtable', None)
|
||||
|
||||
def test_post_anonymous(self):
|
||||
self._run_test('POST', 401, None, {u'namespace': 'public',
|
||||
u'repository': 'publicrepo'})
|
||||
|
||||
def test_post_freshuser(self):
|
||||
self._run_test('POST', 201, 'freshuser', {u'namespace': 'public',
|
||||
u'repository': 'publicrepo'})
|
||||
|
||||
def test_post_reader(self):
|
||||
self._run_test('POST', 201, 'reader', {u'namespace': 'public',
|
||||
u'repository': 'publicrepo'})
|
||||
|
||||
def test_post_devtable(self):
|
||||
self._run_test('POST', 201, 'devtable', {u'namespace': 'public',
|
||||
u'repository': 'publicrepo'})
|
||||
|
||||
|
||||
class TestUserStarredRepository(ApiTestCase):
|
||||
def setUp(self):
|
||||
ApiTestCase.setUp(self)
|
||||
self._set_url(StarredRepository, repository="public/publicrepo")
|
||||
|
||||
def test_delete_anonymous(self):
|
||||
self._run_test('DELETE', 401, None, None)
|
||||
|
||||
def test_delete_freshuser(self):
|
||||
self._run_test('DELETE', 400, 'freshuser', None)
|
||||
|
||||
def test_delete_reader(self):
|
||||
self._run_test('DELETE', 400, 'reader', None)
|
||||
|
||||
def test_delete_devtable(self):
|
||||
self._run_test('DELETE', 400, 'devtable', None)
|
||||
|
||||
|
||||
class TestUserNotification(ApiTestCase):
|
||||
def setUp(self):
|
||||
ApiTestCase.setUp(self)
|
||||
|
|
Reference in a new issue