Creating message api.
This commit is contained in:
parent
651639bb76
commit
002f533bf8
2 changed files with 13 additions and 3 deletions
|
@ -822,7 +822,7 @@ class SuperUserServiceKeyApproval(ApiResource):
|
||||||
|
|
||||||
@resource('/v1/superuser/messages')
|
@resource('/v1/superuser/messages')
|
||||||
@show_if(features.SUPER_USERS)
|
@show_if(features.SUPER_USERS)
|
||||||
class ListMessages(ApiResource):
|
class Messages(ApiResource):
|
||||||
""" Resource for getting a list of super user messages """
|
""" Resource for getting a list of super user messages """
|
||||||
|
|
||||||
schemas = {
|
schemas = {
|
||||||
|
@ -850,10 +850,14 @@ class ListMessages(ApiResource):
|
||||||
}
|
}
|
||||||
|
|
||||||
@nickname('getMessages')
|
@nickname('getMessages')
|
||||||
@require_scope(scopes.SUPERUSER)
|
|
||||||
def get(self):
|
def get(self):
|
||||||
""" Return a super users messages """
|
""" Return a super users messages """
|
||||||
messages = []
|
messages = []
|
||||||
return {
|
return {
|
||||||
'messages': messages,
|
'messages': messages,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@require_scope(scopes.SUPERUSER)
|
||||||
|
def post(self):
|
||||||
|
""" Create a message """
|
||||||
|
pass
|
||||||
|
|
|
@ -65,7 +65,8 @@ from endpoints.api.permission import (RepositoryUserPermission, RepositoryTeamPe
|
||||||
RepositoryTeamPermissionList, RepositoryUserPermissionList)
|
RepositoryTeamPermissionList, RepositoryUserPermissionList)
|
||||||
from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement,
|
from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement,
|
||||||
SuperUserServiceKeyManagement, SuperUserServiceKey,
|
SuperUserServiceKeyManagement, SuperUserServiceKey,
|
||||||
SuperUserServiceKeyApproval, SuperUserTakeOwnership)
|
SuperUserServiceKeyApproval, SuperUserTakeOwnership,
|
||||||
|
Messages)
|
||||||
from endpoints.api.secscan import RepositoryImageSecurity
|
from endpoints.api.secscan import RepositoryImageSecurity
|
||||||
from endpoints.api.suconfig import (SuperUserRegistryStatus, SuperUserConfig, SuperUserConfigFile,
|
from endpoints.api.suconfig import (SuperUserRegistryStatus, SuperUserConfig, SuperUserConfigFile,
|
||||||
SuperUserCreateInitialSuperUser)
|
SuperUserCreateInitialSuperUser)
|
||||||
|
@ -4278,6 +4279,11 @@ class TestSuperUserManagement(ApiTestCase):
|
||||||
self.assertEquals('freshuser', json['username'])
|
self.assertEquals('freshuser', json['username'])
|
||||||
self.assertEquals('foo@bar.com', json['email'])
|
self.assertEquals('foo@bar.com', json['email'])
|
||||||
|
|
||||||
|
def test_set_message(self):
|
||||||
|
self.login(ADMIN_ACCESS_USER)
|
||||||
|
|
||||||
|
# Create a message
|
||||||
|
self.postJsonResponse(Messages)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Reference in a new issue