From 002f533bf8ee84a727ca85d02e5d7edaf7d1b088 Mon Sep 17 00:00:00 2001 From: charltonaustin Date: Fri, 7 Oct 2016 10:22:30 -0400 Subject: [PATCH] Creating message api. --- endpoints/api/superuser.py | 8 ++++++-- test/test_api_usage.py | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index cde035723..429eae2a7 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -822,7 +822,7 @@ class SuperUserServiceKeyApproval(ApiResource): @resource('/v1/superuser/messages') @show_if(features.SUPER_USERS) -class ListMessages(ApiResource): +class Messages(ApiResource): """ Resource for getting a list of super user messages """ schemas = { @@ -850,10 +850,14 @@ class ListMessages(ApiResource): } @nickname('getMessages') - @require_scope(scopes.SUPERUSER) def get(self): """ Return a super users messages """ messages = [] return { 'messages': messages, } + + @require_scope(scopes.SUPERUSER) + def post(self): + """ Create a message """ + pass diff --git a/test/test_api_usage.py b/test/test_api_usage.py index 7a55fee38..53d19bb01 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -65,7 +65,8 @@ from endpoints.api.permission import (RepositoryUserPermission, RepositoryTeamPe RepositoryTeamPermissionList, RepositoryUserPermissionList) from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement, SuperUserServiceKeyManagement, SuperUserServiceKey, - SuperUserServiceKeyApproval, SuperUserTakeOwnership) + SuperUserServiceKeyApproval, SuperUserTakeOwnership, + Messages) from endpoints.api.secscan import RepositoryImageSecurity from endpoints.api.suconfig import (SuperUserRegistryStatus, SuperUserConfig, SuperUserConfigFile, SuperUserCreateInitialSuperUser) @@ -4278,6 +4279,11 @@ class TestSuperUserManagement(ApiTestCase): self.assertEquals('freshuser', json['username']) 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__': unittest.main()