{"action":"created","comment":{"url":"https://api.github.com/repos/saltstack/salt/pulls/comments/56869428","id":56869428,"diff_hunk":"@@ -0,0 +1,175 @@\n+# -*- coding: utf-8 -*-\n+'''\n+Integration tests for mac_timezone\n+'''\n+\n+# Import python libs\n+from __future__ import absolute_import\n+from datetime import datetime\n+\n+# Import Salt Testing libs\n+from salttesting.helpers import ensure_in_syspath\n+ensure_in_syspath('../../')\n+\n+# Import salt libs\n+import integration\n+import salt.utils\n+\n+USE_NETWORK_TIME = False\n+TIME_SERVER = 'time.apple.com'\n+TIME_ZONE = ''\n+CURRENT_DATE = ''\n+CURRENT_TIME = ''\n+\n+\n+class MacTimezoneModuleTest(integration.ModuleCase):\n+    '''\n+    Validate the mac_timezone module\n+    '''\n+\n+    def setUp(self):\n+        '''\n+        Get current settings\n+        '''\n+        if not salt.utils.is_darwin():\n+            self.skipTest('Test only available on Mac OS X')\n+\n+        if not salt.utils.which('systemsetup'):\n+            self.skipTest('Test requires systemsetup binary')\n+\n+        if salt.utils.get_uid(salt.utils.get_user()) != 0:\n+            self.skipTest('Test requires root')\n+\n+        USE_NETWORK_TIME = self.run_function('timezone.get_using_network_time')\n+        TIME_SERVER = self.run_function('timezone.get_time_server')\n+        TIME_ZONE = self.run_function('timezone.get_zone')\n+        CURRENT_DATE = self.run_function('timezone.get_date')\n+        CURRENT_TIME = self.run_function('timezone.get_time')\n+\n+        self.run_function('timezone.set_using_network_time', [False])\n+\n+    def tearDown(self):\n+        '''\n+        Reset to original settings\n+        '''\n+        self.run_function('timezone.set_time_server', [TIME_SERVER])\n+        self.run_function('timezone.set_using_network_time', [USE_NETWORK_TIME])\n+        self.run_function('timezone.set_zone', [TIME_ZONE])\n+        if not USE_NETWORK_TIME:\n+            self.run_function('timezone.set_date', [CURRENT_DATE])\n+            self.run_function('timezone.set_time', [CURRENT_TIME])\n+\n+    def test_get_set_date(self):\n+        '''\n+        Test timezone.get_date\n+        Test timezone.set_date\n+        '''\n+        # Correct Functionality\n+        self.assertTrue(self.run_function('timezone.set_date', ['2/20/2011']))\n+        self.assertEqual(self.run_function('timezone.get_date'), '2/20/2011')\n+\n+        # Test bad date format\n+        self.assertEqual(\n+            self.run_function('timezone.set_date', ['13/12/2014']),\n+            'ERROR executing \\'timezone.set_date\\': '\n+            'Invalid Date/Time Format: 13/12/2014'\n+        )\n+\n+    def test_get_set_time(self):\n+        '''\n+        Test timezone.get_time\n+        Test timezone.set_time\n+        '''\n+        # Correct Functionality\n+        self.assertTrue(self.run_function('timezone.set_time', ['3:14']))\n+        new_time = self.run_function('timezone.get_time')\n+        new_time = datetime.strptime(new_time, '%H:%M:%S').strftime('%H:%M')\n+        self.assertEqual(new_time, '03:14')","path":"tests/integration/modules/mac_timezone.py","position":87,"original_position":87,"commit_id":"b9ffb3bed7c685bd5c387e00f9af0e531033419b","original_commit_id":"b9ffb3bed7c685bd5c387e00f9af0e531033419b","user":{"login":"cachedout","id":111616,"avatar_url":"https://avatars.githubusercontent.com/u/111616?v=3","gravatar_id":"","url":"https://api.github.com/users/cachedout","html_url":"https://github.com/cachedout","followers_url":"https://api.github.com/users/cachedout/followers","following_url":"https://api.github.com/users/cachedout/following{/other_user}","gists_url":"https://api.github.com/users/cachedout/gists{/gist_id}","starred_url":"https://api.github.com/users/cachedout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cachedout/subscriptions","organizations_url":"https://api.github.com/users/cachedout/orgs","repos_url":"https://api.github.com/users/cachedout/repos","events_url":"https://api.github.com/users/cachedout/events{/privacy}","received_events_url":"https://api.github.com/users/cachedout/received_events","type":"User","site_admin":false},"body":"This is a race condition.","created_at":"2016-03-21T18:12:53Z","updated_at":"2016-03-21T18:12:53Z","html_url":"https://github.com/saltstack/salt/pull/31959#discussion_r56869428","pull_request_url":"https://api.github.com/repos/saltstack/salt/pulls/31959","_links":{"self":{"href":"https://api.github.com/repos/saltstack/salt/pulls/comments/56869428"},"html":{"href":"https://github.com/saltstack/salt/pull/31959#discussion_r56869428"},"pull_request":{"href":"https://api.github.com/repos/saltstack/salt/pulls/31959"}}},"pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/31959","id":63282467,"html_url":"https://github.com/saltstack/salt/pull/31959","diff_url":"https://github.com/saltstack/salt/pull/31959.diff","patch_url":"https://github.com/saltstack/salt/pull/31959.patch","issue_url":"https://api.github.com/repos/saltstack/salt/issues/31959","number":31959,"state":"open","locked":false,"title":"Integration tests for mac_timezone.py","user":{"login":"twangboy","id":9383935,"avatar_url":"https://avatars.githubusercontent.com/u/9383935?v=3","gravatar_id":"","url":"https://api.github.com/users/twangboy","html_url":"https://github.com/twangboy","followers_url":"https://api.github.com/users/twangboy/followers","following_url":"https://api.github.com/users/twangboy/following{/other_user}","gists_url":"https://api.github.com/users/twangboy/gists{/gist_id}","starred_url":"https://api.github.com/users/twangboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twangboy/subscriptions","organizations_url":"https://api.github.com/users/twangboy/orgs","repos_url":"https://api.github.com/users/twangboy/repos","events_url":"https://api.github.com/users/twangboy/events{/privacy}","received_events_url":"https://api.github.com/users/twangboy/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\nAdds integration tests for `mac_timezone.py` execution module\r\n\r\n### What issues does this PR fix or reference?\r\nhttps://github.com/saltstack/zh/issues/553\r\n\r\n### Tests written?\r\n- [x] Yes\r\n- [ ] No","created_at":"2016-03-17T19:53:38Z","updated_at":"2016-03-21T18:12:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"123b124085a34de2253079f2d324babb084d3e45","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/saltstack/salt/pulls/31959/commits","review_comments_url":"https://api.github.com/repos/saltstack/salt/pulls/31959/comments","review_comment_url":"https://api.github.com/repos/saltstack/salt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/31959/comments","statuses_url":"https://api.github.com/repos/saltstack/salt/statuses/b9ffb3bed7c685bd5c387e00f9af0e531033419b","head":{"label":"twangboy:mac_timezone_int","ref":"mac_timezone_int","sha":"b9ffb3bed7c685bd5c387e00f9af0e531033419b","user":{"login":"twangboy","id":9383935,"avatar_url":"https://avatars.githubusercontent.com/u/9383935?v=3","gravatar_id":"","url":"https://api.github.com/users/twangboy","html_url":"https://github.com/twangboy","followers_url":"https://api.github.com/users/twangboy/followers","following_url":"https://api.github.com/users/twangboy/following{/other_user}","gists_url":"https://api.github.com/users/twangboy/gists{/gist_id}","starred_url":"https://api.github.com/users/twangboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twangboy/subscriptions","organizations_url":"https://api.github.com/users/twangboy/orgs","repos_url":"https://api.github.com/users/twangboy/repos","events_url":"https://api.github.com/users/twangboy/events{/privacy}","received_events_url":"https://api.github.com/users/twangboy/received_events","type":"User","site_admin":false},"repo":{"id":52046096,"name":"salt","full_name":"twangboy/salt","owner":{"login":"twangboy","id":9383935,"avatar_url":"https://avatars.githubusercontent.com/u/9383935?v=3","gravatar_id":"","url":"https://api.github.com/users/twangboy","html_url":"https://github.com/twangboy","followers_url":"https://api.github.com/users/twangboy/followers","following_url":"https://api.github.com/users/twangboy/following{/other_user}","gists_url":"https://api.github.com/users/twangboy/gists{/gist_id}","starred_url":"https://api.github.com/users/twangboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twangboy/subscriptions","organizations_url":"https://api.github.com/users/twangboy/orgs","repos_url":"https://api.github.com/users/twangboy/repos","events_url":"https://api.github.com/users/twangboy/events{/privacy}","received_events_url":"https://api.github.com/users/twangboy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/twangboy/salt","description":"Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt Open software package repository here: ","fork":true,"url":"https://api.github.com/repos/twangboy/salt","forks_url":"https://api.github.com/repos/twangboy/salt/forks","keys_url":"https://api.github.com/repos/twangboy/salt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twangboy/salt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twangboy/salt/teams","hooks_url":"https://api.github.com/repos/twangboy/salt/hooks","issue_events_url":"https://api.github.com/repos/twangboy/salt/issues/events{/number}","events_url":"https://api.github.com/repos/twangboy/salt/events","assignees_url":"https://api.github.com/repos/twangboy/salt/assignees{/user}","branches_url":"https://api.github.com/repos/twangboy/salt/branches{/branch}","tags_url":"https://api.github.com/repos/twangboy/salt/tags","blobs_url":"https://api.github.com/repos/twangboy/salt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twangboy/salt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twangboy/salt/git/refs{/sha}","trees_url":"https://api.github.com/repos/twangboy/salt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twangboy/salt/statuses/{sha}","languages_url":"https://api.github.com/repos/twangboy/salt/languages","stargazers_url":"https://api.github.com/repos/twangboy/salt/stargazers","contributors_url":"https://api.github.com/repos/twangboy/salt/contributors","subscribers_url":"https://api.github.com/repos/twangboy/salt/subscribers","subscription_url":"https://api.github.com/repos/twangboy/salt/subscription","commits_url":"https://api.github.com/repos/twangboy/salt/commits{/sha}","git_commits_url":"https://api.github.com/repos/twangboy/salt/git/commits{/sha}","comments_url":"https://api.github.com/repos/twangboy/salt/comments{/number}","issue_comment_url":"https://api.github.com/repos/twangboy/salt/issues/comments{/number}","contents_url":"https://api.github.com/repos/twangboy/salt/contents/{+path}","compare_url":"https://api.github.com/repos/twangboy/salt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twangboy/salt/merges","archive_url":"https://api.github.com/repos/twangboy/salt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twangboy/salt/downloads","issues_url":"https://api.github.com/repos/twangboy/salt/issues{/number}","pulls_url":"https://api.github.com/repos/twangboy/salt/pulls{/number}","milestones_url":"https://api.github.com/repos/twangboy/salt/milestones{/number}","notifications_url":"https://api.github.com/repos/twangboy/salt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twangboy/salt/labels{/name}","releases_url":"https://api.github.com/repos/twangboy/salt/releases{/id}","deployments_url":"https://api.github.com/repos/twangboy/salt/deployments","created_at":"2016-02-18T23:18:37Z","updated_at":"2016-02-18T23:18:49Z","pushed_at":"2016-03-21T18:11:04Z","git_url":"git://github.com/twangboy/salt.git","ssh_url":"git@github.com:twangboy/salt.git","clone_url":"https://github.com/twangboy/salt.git","svn_url":"https://github.com/twangboy/salt","homepage":"https://repo.saltstack.com/","size":153702,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"saltstack:2016.3","ref":"2016.3","sha":"fb6d5fa44b6d194e59f9413fad8a9245222d30df","user":{"login":"saltstack","id":1147473,"avatar_url":"https://avatars.githubusercontent.com/u/1147473?v=3","gravatar_id":"","url":"https://api.github.com/users/saltstack","html_url":"https://github.com/saltstack","followers_url":"https://api.github.com/users/saltstack/followers","following_url":"https://api.github.com/users/saltstack/following{/other_user}","gists_url":"https://api.github.com/users/saltstack/gists{/gist_id}","starred_url":"https://api.github.com/users/saltstack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltstack/subscriptions","organizations_url":"https://api.github.com/users/saltstack/orgs","repos_url":"https://api.github.com/users/saltstack/repos","events_url":"https://api.github.com/users/saltstack/events{/privacy}","received_events_url":"https://api.github.com/users/saltstack/received_events","type":"Organization","site_admin":false},"repo":{"id":1390248,"name":"salt","full_name":"saltstack/salt","owner":{"login":"saltstack","id":1147473,"avatar_url":"https://avatars.githubusercontent.com/u/1147473?v=3","gravatar_id":"","url":"https://api.github.com/users/saltstack","html_url":"https://github.com/saltstack","followers_url":"https://api.github.com/users/saltstack/followers","following_url":"https://api.github.com/users/saltstack/following{/other_user}","gists_url":"https://api.github.com/users/saltstack/gists{/gist_id}","starred_url":"https://api.github.com/users/saltstack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltstack/subscriptions","organizations_url":"https://api.github.com/users/saltstack/orgs","repos_url":"https://api.github.com/users/saltstack/repos","events_url":"https://api.github.com/users/saltstack/events{/privacy}","received_events_url":"https://api.github.com/users/saltstack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/saltstack/salt","description":"Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt Open software package repository here: ","fork":false,"url":"https://api.github.com/repos/saltstack/salt","forks_url":"https://api.github.com/repos/saltstack/salt/forks","keys_url":"https://api.github.com/repos/saltstack/salt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saltstack/salt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saltstack/salt/teams","hooks_url":"https://api.github.com/repos/saltstack/salt/hooks","issue_events_url":"https://api.github.com/repos/saltstack/salt/issues/events{/number}","events_url":"https://api.github.com/repos/saltstack/salt/events","assignees_url":"https://api.github.com/repos/saltstack/salt/assignees{/user}","branches_url":"https://api.github.com/repos/saltstack/salt/branches{/branch}","tags_url":"https://api.github.com/repos/saltstack/salt/tags","blobs_url":"https://api.github.com/repos/saltstack/salt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saltstack/salt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saltstack/salt/git/refs{/sha}","trees_url":"https://api.github.com/repos/saltstack/salt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saltstack/salt/statuses/{sha}","languages_url":"https://api.github.com/repos/saltstack/salt/languages","stargazers_url":"https://api.github.com/repos/saltstack/salt/stargazers","contributors_url":"https://api.github.com/repos/saltstack/salt/contributors","subscribers_url":"https://api.github.com/repos/saltstack/salt/subscribers","subscription_url":"https://api.github.com/repos/saltstack/salt/subscription","commits_url":"https://api.github.com/repos/saltstack/salt/commits{/sha}","git_commits_url":"https://api.github.com/repos/saltstack/salt/git/commits{/sha}","comments_url":"https://api.github.com/repos/saltstack/salt/comments{/number}","issue_comment_url":"https://api.github.com/repos/saltstack/salt/issues/comments{/number}","contents_url":"https://api.github.com/repos/saltstack/salt/contents/{+path}","compare_url":"https://api.github.com/repos/saltstack/salt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saltstack/salt/merges","archive_url":"https://api.github.com/repos/saltstack/salt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saltstack/salt/downloads","issues_url":"https://api.github.com/repos/saltstack/salt/issues{/number}","pulls_url":"https://api.github.com/repos/saltstack/salt/pulls{/number}","milestones_url":"https://api.github.com/repos/saltstack/salt/milestones{/number}","notifications_url":"https://api.github.com/repos/saltstack/salt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saltstack/salt/labels{/name}","releases_url":"https://api.github.com/repos/saltstack/salt/releases{/id}","deployments_url":"https://api.github.com/repos/saltstack/salt/deployments","created_at":"2011-02-20T20:16:56Z","updated_at":"2016-03-21T16:41:43Z","pushed_at":"2016-03-21T18:01:14Z","git_url":"git://github.com/saltstack/salt.git","ssh_url":"git@github.com:saltstack/salt.git","clone_url":"https://github.com/saltstack/salt.git","svn_url":"https://github.com/saltstack/salt","homepage":"https://repo.saltstack.com/","size":169793,"stargazers_count":6333,"watchers_count":6333,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2777,"mirror_url":null,"open_issues_count":3445,"forks":2777,"open_issues":3445,"watchers":6333,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/saltstack/salt/pulls/31959"},"html":{"href":"https://github.com/saltstack/salt/pull/31959"},"issue":{"href":"https://api.github.com/repos/saltstack/salt/issues/31959"},"comments":{"href":"https://api.github.com/repos/saltstack/salt/issues/31959/comments"},"review_comments":{"href":"https://api.github.com/repos/saltstack/salt/pulls/31959/comments"},"review_comment":{"href":"https://api.github.com/repos/saltstack/salt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/saltstack/salt/pulls/31959/commits"},"statuses":{"href":"https://api.github.com/repos/saltstack/salt/statuses/b9ffb3bed7c685bd5c387e00f9af0e531033419b"}}}}