{"action":"created","comment":{"url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/comments/81096158","pull_request_review_id":2100501,"id":81096158,"diff_hunk":"@@ -0,0 +1,91 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+\"\"\"\n+This test check the commands\n+\"\"\"\n+\n+from __future__ import print_function\n+import os\n+import time\n+import shlex\n+import subprocess\n+import copy\n+import requests\n+import unittest2\n+\n+\n+class TestGroups(unittest2.TestCase):\n+    \"\"\"\n+    This class test hostgroups and tree feature\n+    \"\"\"\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        \"\"\"\n+        This method:\n+          * deletes mongodb database\n+          * starts the backend with uwsgi\n+          * logs in the backend and get the token\n+          * gets the hostgroup\n+\n+        :return: None\n+        \"\"\"\n+        # Set test mode for Alignak backend\n+        os.environ['TEST_ALIGNAK_BACKEND'] = '1'\n+        os.environ['ALIGNAK_BACKEND_MONGO_DBNAME'] = 'alignak-backend-test'\n+\n+        # Delete used mongo DBs\n+        exit_code = subprocess.call(\n+            shlex.split(\n+                'mongo %s --eval \"db.dropDatabase()\"' % os.environ['ALIGNAK_BACKEND_MONGO_DBNAME'])\n+        )\n+        assert exit_code == 0\n+\n+        cls.p = subprocess.Popen(['uwsgi', '--plugin', 'python', '-w', 'alignakbackend:app',\n+                                  '--socket', '0.0.0.0:5000',\n+                                  '--protocol=http', '--enable-threads', '--pidfile',\n+                                  '/tmp/uwsgi.pid'])\n+        time.sleep(3)\n+\n+        cls.endpoint = 'http://127.0.0.1:5000'\n+\n+        headers = {'Content-Type': 'application/json'}\n+        params = {'username': 'admin', 'password': 'admin', 'action': 'generate'}\n+        # get token\n+        response = requests.post(cls.endpoint + '/login', json=params, headers=headers)\n+        resp = response.json()\n+        cls.token = resp['token']\n+        cls.auth = requests.auth.HTTPBasicAuth(cls.token, '')\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        \"\"\"\n+        Kill uwsgi\n+\n+        :return: None\n+        \"\"\"\n+        subprocess.call(['uwsgi', '--stop', '/tmp/uwsgi.pid'])\n+        time.sleep(2)\n+\n+    @classmethod\n+    def tearDown(cls):\n+        \"\"\"\n+        Delete resources in backend\n+\n+        :return: None\n+        \"\"\"\n+        for resource in ['host', 'service', 'command', 'livestate', 'livesynthesis']:\n+            requests.delete(cls.endpoint + '/' + resource, auth=cls.auth)\n+\n+    def test_default_commands(self):\n+        \"\"\"\n+        Default cmomands exist ..","path":"test/test_commands.py","position":82,"original_position":82,"commit_id":"f41dab9b54b31842bd7ce3a0f1f1595f3388ae0c","original_commit_id":"f41dab9b54b31842bd7ce3a0f1f1595f3388ae0c","user":{"login":"ddurieux","id":239744,"avatar_url":"https://avatars.githubusercontent.com/u/239744?v=3","gravatar_id":"","url":"https://api.github.com/users/ddurieux","html_url":"https://github.com/ddurieux","followers_url":"https://api.github.com/users/ddurieux/followers","following_url":"https://api.github.com/users/ddurieux/following{/other_user}","gists_url":"https://api.github.com/users/ddurieux/gists{/gist_id}","starred_url":"https://api.github.com/users/ddurieux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddurieux/subscriptions","organizations_url":"https://api.github.com/users/ddurieux/orgs","repos_url":"https://api.github.com/users/ddurieux/repos","events_url":"https://api.github.com/users/ddurieux/events{/privacy}","received_events_url":"https://api.github.com/users/ddurieux/received_events","type":"User","site_admin":false},"body":"typo command ;)","created_at":"2016-09-29T09:21:40Z","updated_at":"2016-09-29T09:21:40Z","html_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151#discussion_r81096158","pull_request_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151","_links":{"self":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/comments/81096158"},"html":{"href":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151#discussion_r81096158"},"pull_request":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151","id":86860031,"html_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151","diff_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151.diff","patch_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151.patch","issue_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/151","number":151,"state":"open","locked":false,"title":"Fix #148, #150, #153","user":{"login":"mohierf","id":2932687,"avatar_url":"https://avatars.githubusercontent.com/u/2932687?v=3","gravatar_id":"","url":"https://api.github.com/users/mohierf","html_url":"https://github.com/mohierf","followers_url":"https://api.github.com/users/mohierf/followers","following_url":"https://api.github.com/users/mohierf/following{/other_user}","gists_url":"https://api.github.com/users/mohierf/gists{/gist_id}","starred_url":"https://api.github.com/users/mohierf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohierf/subscriptions","organizations_url":"https://api.github.com/users/mohierf/orgs","repos_url":"https://api.github.com/users/mohierf/repos","events_url":"https://api.github.com/users/mohierf/events{/privacy}","received_events_url":"https://api.github.com/users/mohierf/received_events","type":"User","site_admin":false},"body":"- #150: add a missing `n` options in allowed values for notification_options of services\r\n- print the settings file name used on start\r\n- #148: create default internal commands (_echo, _internal_host_up)\r\n- #153: create a default `_dummy` host template to be used by service templates\r\n- fix default configuration directory name to *alignak-backend*\r\n- add sample configuration files","created_at":"2016-09-27T04:19:29Z","updated_at":"2016-09-29T09:21:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93f53a02a23a231b681fcc47737decad9b4e568c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151/commits","review_comments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151/comments","review_comment_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/151/comments","statuses_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/statuses/f41dab9b54b31842bd7ce3a0f1f1595f3388ae0c","head":{"label":"Alignak-monitoring-contrib:Fix-#150","ref":"Fix-#150","sha":"f41dab9b54b31842bd7ce3a0f1f1595f3388ae0c","user":{"login":"Alignak-monitoring-contrib","id":14056682,"avatar_url":"https://avatars.githubusercontent.com/u/14056682?v=3","gravatar_id":"","url":"https://api.github.com/users/Alignak-monitoring-contrib","html_url":"https://github.com/Alignak-monitoring-contrib","followers_url":"https://api.github.com/users/Alignak-monitoring-contrib/followers","following_url":"https://api.github.com/users/Alignak-monitoring-contrib/following{/other_user}","gists_url":"https://api.github.com/users/Alignak-monitoring-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/Alignak-monitoring-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alignak-monitoring-contrib/subscriptions","organizations_url":"https://api.github.com/users/Alignak-monitoring-contrib/orgs","repos_url":"https://api.github.com/users/Alignak-monitoring-contrib/repos","events_url":"https://api.github.com/users/Alignak-monitoring-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/Alignak-monitoring-contrib/received_events","type":"Organization","site_admin":false},"repo":{"id":41268232,"name":"alignak-backend","full_name":"Alignak-monitoring-contrib/alignak-backend","owner":{"login":"Alignak-monitoring-contrib","id":14056682,"avatar_url":"https://avatars.githubusercontent.com/u/14056682?v=3","gravatar_id":"","url":"https://api.github.com/users/Alignak-monitoring-contrib","html_url":"https://github.com/Alignak-monitoring-contrib","followers_url":"https://api.github.com/users/Alignak-monitoring-contrib/followers","following_url":"https://api.github.com/users/Alignak-monitoring-contrib/following{/other_user}","gists_url":"https://api.github.com/users/Alignak-monitoring-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/Alignak-monitoring-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alignak-monitoring-contrib/subscriptions","organizations_url":"https://api.github.com/users/Alignak-monitoring-contrib/orgs","repos_url":"https://api.github.com/users/Alignak-monitoring-contrib/repos","events_url":"https://api.github.com/users/Alignak-monitoring-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/Alignak-monitoring-contrib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend","description":"Backend for alignak (REST API for configuration, retention, livestate, logs) based on Python Eve","fork":false,"url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend","forks_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/forks","keys_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/teams","hooks_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/hooks","issue_events_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/events","assignees_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/tags","blobs_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/languages","stargazers_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/stargazers","contributors_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/contributors","subscribers_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/subscribers","subscription_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/subscription","commits_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/merges","archive_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/downloads","issues_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/labels{/name}","releases_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/deployments","created_at":"2015-08-23T21:32:21Z","updated_at":"2016-06-17T12:22:01Z","pushed_at":"2016-09-29T09:12:30Z","git_url":"git://github.com/Alignak-monitoring-contrib/alignak-backend.git","ssh_url":"git@github.com:Alignak-monitoring-contrib/alignak-backend.git","clone_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend.git","svn_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend","homepage":"","size":2000,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":3,"default_branch":"develop"}},"base":{"label":"Alignak-monitoring-contrib:develop","ref":"develop","sha":"bb23fb5a9448b9c227fdc6f0eb977db074adc7a4","user":{"login":"Alignak-monitoring-contrib","id":14056682,"avatar_url":"https://avatars.githubusercontent.com/u/14056682?v=3","gravatar_id":"","url":"https://api.github.com/users/Alignak-monitoring-contrib","html_url":"https://github.com/Alignak-monitoring-contrib","followers_url":"https://api.github.com/users/Alignak-monitoring-contrib/followers","following_url":"https://api.github.com/users/Alignak-monitoring-contrib/following{/other_user}","gists_url":"https://api.github.com/users/Alignak-monitoring-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/Alignak-monitoring-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alignak-monitoring-contrib/subscriptions","organizations_url":"https://api.github.com/users/Alignak-monitoring-contrib/orgs","repos_url":"https://api.github.com/users/Alignak-monitoring-contrib/repos","events_url":"https://api.github.com/users/Alignak-monitoring-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/Alignak-monitoring-contrib/received_events","type":"Organization","site_admin":false},"repo":{"id":41268232,"name":"alignak-backend","full_name":"Alignak-monitoring-contrib/alignak-backend","owner":{"login":"Alignak-monitoring-contrib","id":14056682,"avatar_url":"https://avatars.githubusercontent.com/u/14056682?v=3","gravatar_id":"","url":"https://api.github.com/users/Alignak-monitoring-contrib","html_url":"https://github.com/Alignak-monitoring-contrib","followers_url":"https://api.github.com/users/Alignak-monitoring-contrib/followers","following_url":"https://api.github.com/users/Alignak-monitoring-contrib/following{/other_user}","gists_url":"https://api.github.com/users/Alignak-monitoring-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/Alignak-monitoring-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alignak-monitoring-contrib/subscriptions","organizations_url":"https://api.github.com/users/Alignak-monitoring-contrib/orgs","repos_url":"https://api.github.com/users/Alignak-monitoring-contrib/repos","events_url":"https://api.github.com/users/Alignak-monitoring-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/Alignak-monitoring-contrib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend","description":"Backend for alignak (REST API for configuration, retention, livestate, logs) based on Python Eve","fork":false,"url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend","forks_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/forks","keys_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/teams","hooks_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/hooks","issue_events_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/events","assignees_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/tags","blobs_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/languages","stargazers_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/stargazers","contributors_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/contributors","subscribers_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/subscribers","subscription_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/subscription","commits_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/merges","archive_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/downloads","issues_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/labels{/name}","releases_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/deployments","created_at":"2015-08-23T21:32:21Z","updated_at":"2016-06-17T12:22:01Z","pushed_at":"2016-09-29T09:12:30Z","git_url":"git://github.com/Alignak-monitoring-contrib/alignak-backend.git","ssh_url":"git@github.com:Alignak-monitoring-contrib/alignak-backend.git","clone_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend.git","svn_url":"https://github.com/Alignak-monitoring-contrib/alignak-backend","homepage":"","size":2000,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151"},"html":{"href":"https://github.com/Alignak-monitoring-contrib/alignak-backend/pull/151"},"issue":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/151"},"comments":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/Alignak-monitoring-contrib/alignak-backend/statuses/f41dab9b54b31842bd7ce3a0f1f1595f3388ae0c"}}}}
{"actor":{"display_login":"ddurieux"}}