{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/62652315","id":62652315,"diff_hunk":"@@ -0,0 +1,228 @@\n+\"\"\"\n+Tests for the maintenance app views.\n+\"\"\"\n+import ddt\n+import itertools\n+\n+from django.core.urlresolvers import reverse\n+from django.utils.translation import ugettext_lazy as _\n+from xmodule.modulestore import ModuleStoreEnum\n+from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase\n+from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory\n+from student.roles import GlobalStaff\n+from student.tests.factories import AdminFactory, UserFactory\n+\n+from contentstore.management.commands.utils import get_course_versions\n+\n+from .views import COURSE_KEY_ERROR_MESSAGES, get_maintenace_urls\n+\n+\n+class CourseKeyMixin(object):\n+    def verify_error_message(self, data, error_msg):\n+        response = self.client.post(self.view_url, data=data)\n+        self.assertContains(response, error_msg, status_code=200)\n+\n+    def verify_invalid_course_key(self, course_key, error_msg):\n+        self.verify_error_message({'course-id': course_key}, error_msg)\n+\n+    def verify_bad_course_keys(self):\n+        self.verify_invalid_course_key('', COURSE_KEY_ERROR_MESSAGES['empty_course_key'])\n+        self.verify_invalid_course_key('edx', COURSE_KEY_ERROR_MESSAGES['invalid_course_key'])\n+        self.verify_invalid_course_key('course-v1:e+d+X', COURSE_KEY_ERROR_MESSAGES['course_key_not_found'])\n+\n+    def validate_success_from_response(self, response, success_message):\n+        self.assertNotContains(response, '<div class=\"error\">', status_code=200)\n+        self.assertContains(response, success_message, status_code=200)\n+\n+\n+class MaintenanceViewTestCase(ModuleStoreTestCase):\n+    \"\"\"\n+    Base class for maintenance view tests.\n+    \"\"\"\n+\n+    def setUp(self):\n+        \"\"\"Create a user and log in. \"\"\"\n+        super(MaintenanceViewTestCase, self).setUp()\n+        self.user = AdminFactory()\n+        success = self.client.login(username=self.user.username, password='test')","path":"cms/djangoapps/maintenance/tests.py","position":47,"original_position":47,"commit_id":"0ed3dfc0fe0a481e530becd0e7fc6a7915809a10","original_commit_id":"0ed3dfc0fe0a481e530becd0e7fc6a7915809a10","user":{"login":"mushtaqak","id":6991154,"avatar_url":"https://avatars.githubusercontent.com/u/6991154?v=3","gravatar_id":"","url":"https://api.github.com/users/mushtaqak","html_url":"https://github.com/mushtaqak","followers_url":"https://api.github.com/users/mushtaqak/followers","following_url":"https://api.github.com/users/mushtaqak/following{/other_user}","gists_url":"https://api.github.com/users/mushtaqak/gists{/gist_id}","starred_url":"https://api.github.com/users/mushtaqak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mushtaqak/subscriptions","organizations_url":"https://api.github.com/users/mushtaqak/orgs","repos_url":"https://api.github.com/users/mushtaqak/repos","events_url":"https://api.github.com/users/mushtaqak/events{/privacy}","received_events_url":"https://api.github.com/users/mushtaqak/received_events","type":"User","site_admin":false},"body":"To check if user was able to log in.","created_at":"2016-05-10T11:06:03Z","updated_at":"2016-05-10T11:06:03Z","html_url":"https://github.com/edx/edx-platform/pull/12237#discussion_r62652315","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/12237","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/62652315"},"html":{"href":"https://github.com/edx/edx-platform/pull/12237#discussion_r62652315"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/12237"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/12237","id":67708448,"html_url":"https://github.com/edx/edx-platform/pull/12237","diff_url":"https://github.com/edx/edx-platform/pull/12237.diff","patch_url":"https://github.com/edx/edx-platform/pull/12237.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/12237","number":12237,"state":"open","locked":false,"title":"Maintenance app and force publish course view","user":{"login":"mushtaqak","id":6991154,"avatar_url":"https://avatars.githubusercontent.com/u/6991154?v=3","gravatar_id":"","url":"https://api.github.com/users/mushtaqak","html_url":"https://github.com/mushtaqak","followers_url":"https://api.github.com/users/mushtaqak/followers","following_url":"https://api.github.com/users/mushtaqak/following{/other_user}","gists_url":"https://api.github.com/users/mushtaqak/gists{/gist_id}","starred_url":"https://api.github.com/users/mushtaqak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mushtaqak/subscriptions","organizations_url":"https://api.github.com/users/mushtaqak/orgs","repos_url":"https://api.github.com/users/mushtaqak/repos","events_url":"https://api.github.com/users/mushtaqak/events{/privacy}","received_events_url":"https://api.github.com/users/mushtaqak/received_events","type":"User","site_admin":false},"body":"**Problems**\r\n\r\nGetting DevOps to run management commands takes quite a bit of time to escalate the critical issues quickly. We often wait for DevOps to execute the commands and then observe the results, so a lot of important time is lost.\r\n\r\n**Solution**\r\nHave a maintenance dashboard for the escalation team that let them interact with advance views for executing the management commands ( which would be replaced by the views eventually).\r\n\r\nMore on Maintenance App [here](https://openedx.atlassian.net/wiki/display/SUST/Maintenance+Board)\r\n\r\nHere is the basic layout of the `Maintenance App`.\r\n\r\n<img width=\"1220\" alt=\"screen shot 2016-05-06 at 6 02 45 pm\" src=\"https://cloud.githubusercontent.com/assets/6991154/15073798/fc31bb16-13b4-11e6-93c9-f8cf1abec7c3.png\">\r\n\r\nHome page adds the the shortcut to maintenace app via a user-account-dropdown\r\n\r\n<img width=\"1219\" alt=\"screen shot 2016-05-06 at 6 02 32 pm\" src=\"https://cloud.githubusercontent.com/assets/6991154/15073772/dcc5c9ca-13b4-11e6-9f6e-a9565eb8a460.png\">\r\n\r\n`studio_url/maintenance` url shows the list of the views available\r\n\r\n<img width=\"1222\" alt=\"screen shot 2016-05-06 at 6 03 09 pm\" src=\"https://cloud.githubusercontent.com/assets/6991154/15073829/1c0b06a4-13b5-11e6-9aff-6f04d0e17e07.png\">\r\n\r\n\r\n`studio_url/maintenance/force_publish_course` url : shows force publish course view\r\n\r\n\r\n\r\nAnd the rest of the pages would follow the same pattern, Here is the list of all the commands that we may want.\r\n\r\n`studio_url/maintenance/show_orphans`\r\n`studio_url/maintenance/delete_orphans`\r\n`studio_url/maintenance/export_course`\r\n`studio_url/maintenance/import_course`\r\n`studio_url/maintenance/delete_course`\r\n\r\n<img width=\"1202\" alt=\"screen shot 2016-04-27 at 8 21 16 pm\" src=\"https://cloud.githubusercontent.com/assets/6991154/15073876/54343280-13b5-11e6-96a9-ad545fbc9f67.png\">\r\n\r\n\r\nthe`/maintenance` would look like this when these views are implemented.\r\n\r\n[SUST-19](https://openedx.atlassian.net/browse/SUST-19) , [SUST-46](https://openedx.atlassian.net/browse/SUST-46)","created_at":"2016-04-25T12:06:50Z","updated_at":"2016-05-10T11:06:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5628ce22ab9aa78b2ee6b70b6fea0ea6a2d4c909","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/12237/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/12237/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/12237/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/0ed3dfc0fe0a481e530becd0e7fc6a7915809a10","head":{"label":"edx:mushtaq/maintenance","ref":"mushtaq/maintenance","sha":"0ed3dfc0fe0a481e530becd0e7fc6a7915809a10","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-05-09T20:36:59Z","pushed_at":"2016-05-10T10:43:40Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":747024,"stargazers_count":2554,"watchers_count":2554,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1557,"mirror_url":null,"open_issues_count":166,"forks":1557,"open_issues":166,"watchers":2554,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"61ef49b94cee06307d8370e40ecd1a12783b59fd","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-05-09T20:36:59Z","pushed_at":"2016-05-10T10:43:40Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":747024,"stargazers_count":2554,"watchers_count":2554,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1557,"mirror_url":null,"open_issues_count":166,"forks":1557,"open_issues":166,"watchers":2554,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/12237"},"html":{"href":"https://github.com/edx/edx-platform/pull/12237"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/12237"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/12237/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/12237/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/12237/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/0ed3dfc0fe0a481e530becd0e7fc6a7915809a10"}}}}