{"action":"created","comment":{"url":"https://api.github.com/repos/rytilahti/python-miio/pulls/comments/153078252","pull_request_review_id":79034476,"id":153078252,"diff_hunk":"@@ -0,0 +1,148 @@\n+from unittest import TestCase\n+from miio import PhilipsEyecare\n+from .dummies import DummyDevice\n+import pytest\n+\n+\n+class DummyPhilipsEyecare(DummyDevice, PhilipsEyecare):\n+    def __init__(self, *args, **kwargs):\n+        self.state = {\n+            'power': 'on',\n+            'bright': 5,\n+            'notifystatus': 'off',\n+            'ambstatus': 'off',\n+            'ambvalue': 41,\n+            'eyecare': 'on',\n+            'scene_num': 3,\n+            'bls': 'on',\n+            'dvalue': 0,\n+        }\n+        self.return_values = {\n+            'get_prop': self._get_state,\n+            'set_power': lambda x: self._set_state(\"power\", x),\n+            'set_eyecare': lambda x: self._set_state(\"eyecare\", x),\n+            'set_bright': lambda x: self._set_state(\"bright\", x),\n+            'set_user_scene': lambda x: self._set_state(\"scene_num\", x),\n+            'delay_off': lambda x: self._set_state(\"dvalue\", x),\n+            'enable_bl': lambda x: self._set_state(\"bls\", x),\n+            'set_notifyuser': lambda x: self._set_state(\"notifystatus\", x),\n+            'enable_amb': lambda x: self._set_state(\"ambstatus\", x),\n+            'set_amb_bright': lambda x: self._set_state(\"ambvalue\", x),\n+        }\n+        super().__init__(args, kwargs)\n+\n+\n+@pytest.fixture(scope=\"class\")\n+def philips_eyecare(request):\n+    request.cls.device = DummyPhilipsEyecare()\n+    # TODO add ability to test on a real device\n+\n+\n+@pytest.mark.usefixtures(\"philips_eyecare\")\n+class TestPhilipsEyecare(TestCase):\n+    def is_on(self):\n+        return self.device.status().is_on\n+\n+    def state(self):\n+        return self.device.status()\n+\n+    def test_on(self):\n+        self.device.off()  # ensure off\n+\n+        start_state = self.is_on()\n+        assert start_state is False\n+\n+        self.device.on()\n+        assert self.is_on() is True\n+\n+    def test_off(self):\n+        self.device.on()  # ensure on\n+\n+        assert self.is_on() is True\n+        self.device.off()\n+        assert self.is_on() is False\n+\n+    def test_status(self):\n+        self.device._reset_state()\n+\n+        assert self.is_on() is True\n+        assert self.state().brightness == self.device.start_state[\"bright\"]\n+        assert self.state().reminder == (self.device.start_state[\"notifystatus\"] == 'on')\n+        assert self.state().ambient == (self.device.start_state[\"ambstatus\"] == 'on')\n+        assert self.state().ambient_brightness == self.device.start_state[\"ambvalue\"]\n+        assert self.state().eyecare == (self.device.start_state[\"eyecare\"] == 'on')\n+        assert self.state().scene == self.device.start_state[\"scene_num\"]\n+        assert self.state().smart_night_light == (self.device.start_state[\"bls\"] == 'on')\n+        assert self.state().delay_off_countdown == self.device.start_state[\"dvalue\"]\n+\n+    def test_eyecare(self):\n+        def eyecare():\n+            return self.device.status().eyecare\n+\n+        self.device.eyecare_on()\n+        assert eyecare() == True\n+        self.device.eyecare_off()\n+        assert eyecare() == False\n+\n+    def test_set_brightness(self):\n+        def brightness():\n+            return self.device.status().brightness\n+\n+        self.device.set_brightness(10)\n+        assert brightness() == 10\n+        self.device.set_brightness(20)\n+        assert brightness() == 20\n+\n+    def test_set_scene(self):\n+        def scene():\n+            return self.device.status().scene\n+\n+        self.device.set_scene(1)\n+        assert scene() == 1\n+        self.device.set_scene(2)\n+        assert scene() == 2\n+\n+    def test_delay_off(self):\n+        def delay_off_countdown():\n+            return self.device.status().delay_off_countdown\n+\n+        self.device.delay_off(100)\n+        assert delay_off_countdown() == 100\n+        self.device.delay_off(200)\n+        assert delay_off_countdown() == 200\n+\n+    def test_smart_night_light(self):\n+        def smart_night_light():\n+            return self.device.status().smart_night_light\n+\n+        self.device.smart_night_light_on()\n+        assert smart_night_light() == True\n+        self.device.smart_night_light_off()\n+        assert smart_night_light() == False\n+\n+    def test_reminder(self):\n+        def reminder():\n+            return self.device.status().reminder\n+\n+        self.device.reminder_on()\n+        assert reminder() == True\n+        self.device.reminder_off()\n+        assert reminder() == False\n+\n+    def test_ambient(self):\n+        def ambient():\n+            return self.device.status().ambient\n+\n+        self.device.ambient_on()\n+        assert ambient() == True","path":"miio/tests/test_philips_eyecare.py","position":137,"original_position":137,"commit_id":"73ec545e45d10983ac8572b9ed2d75f10c0e8ea4","original_commit_id":"73ec545e45d10983ac8572b9ed2d75f10c0e8ea4","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"comparison to True should be 'if cond is True:' or 'if cond:'","created_at":"2017-11-26T18:31:44Z","updated_at":"2017-11-26T18:31:45Z","html_url":"https://github.com/rytilahti/python-miio/pull/133#discussion_r153078252","pull_request_url":"https://api.github.com/repos/rytilahti/python-miio/pulls/133","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/comments/153078252"},"html":{"href":"https://github.com/rytilahti/python-miio/pull/133#discussion_r153078252"},"pull_request":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/rytilahti/python-miio/pulls/133","id":154690864,"html_url":"https://github.com/rytilahti/python-miio/pull/133","diff_url":"https://github.com/rytilahti/python-miio/pull/133.diff","patch_url":"https://github.com/rytilahti/python-miio/pull/133.patch","issue_url":"https://api.github.com/repos/rytilahti/python-miio/issues/133","number":133,"state":"open","locked":false,"title":"Unit tests for philip lights","user":{"login":"syssi","id":2735933,"avatar_url":"https://avatars3.githubusercontent.com/u/2735933?v=4","gravatar_id":"","url":"https://api.github.com/users/syssi","html_url":"https://github.com/syssi","followers_url":"https://api.github.com/users/syssi/followers","following_url":"https://api.github.com/users/syssi/following{/other_user}","gists_url":"https://api.github.com/users/syssi/gists{/gist_id}","starred_url":"https://api.github.com/users/syssi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syssi/subscriptions","organizations_url":"https://api.github.com/users/syssi/orgs","repos_url":"https://api.github.com/users/syssi/repos","events_url":"https://api.github.com/users/syssi/events{/privacy}","received_events_url":"https://api.github.com/users/syssi/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-26T18:31:36Z","updated_at":"2017-11-26T18:31:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30d1a74cd8055d53542c96c51054024ce6377e3e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/rytilahti/python-miio/pulls/133/commits","review_comments_url":"https://api.github.com/repos/rytilahti/python-miio/pulls/133/comments","review_comment_url":"https://api.github.com/repos/rytilahti/python-miio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rytilahti/python-miio/issues/133/comments","statuses_url":"https://api.github.com/repos/rytilahti/python-miio/statuses/73ec545e45d10983ac8572b9ed2d75f10c0e8ea4","head":{"label":"syssi:feature/pytests-philipslights","ref":"feature/pytests-philipslights","sha":"73ec545e45d10983ac8572b9ed2d75f10c0e8ea4","user":{"login":"syssi","id":2735933,"avatar_url":"https://avatars3.githubusercontent.com/u/2735933?v=4","gravatar_id":"","url":"https://api.github.com/users/syssi","html_url":"https://github.com/syssi","followers_url":"https://api.github.com/users/syssi/followers","following_url":"https://api.github.com/users/syssi/following{/other_user}","gists_url":"https://api.github.com/users/syssi/gists{/gist_id}","starred_url":"https://api.github.com/users/syssi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syssi/subscriptions","organizations_url":"https://api.github.com/users/syssi/orgs","repos_url":"https://api.github.com/users/syssi/repos","events_url":"https://api.github.com/users/syssi/events{/privacy}","received_events_url":"https://api.github.com/users/syssi/received_events","type":"User","site_admin":false},"repo":{"id":98122165,"name":"python-mirobo","full_name":"syssi/python-mirobo","owner":{"login":"syssi","id":2735933,"avatar_url":"https://avatars3.githubusercontent.com/u/2735933?v=4","gravatar_id":"","url":"https://api.github.com/users/syssi","html_url":"https://github.com/syssi","followers_url":"https://api.github.com/users/syssi/followers","following_url":"https://api.github.com/users/syssi/following{/other_user}","gists_url":"https://api.github.com/users/syssi/gists{/gist_id}","starred_url":"https://api.github.com/users/syssi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syssi/subscriptions","organizations_url":"https://api.github.com/users/syssi/orgs","repos_url":"https://api.github.com/users/syssi/repos","events_url":"https://api.github.com/users/syssi/events{/privacy}","received_events_url":"https://api.github.com/users/syssi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/syssi/python-mirobo","description":"Python library & console tool for controlling Xiaomi Vacuum cleaner robot","fork":true,"url":"https://api.github.com/repos/syssi/python-mirobo","forks_url":"https://api.github.com/repos/syssi/python-mirobo/forks","keys_url":"https://api.github.com/repos/syssi/python-mirobo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syssi/python-mirobo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syssi/python-mirobo/teams","hooks_url":"https://api.github.com/repos/syssi/python-mirobo/hooks","issue_events_url":"https://api.github.com/repos/syssi/python-mirobo/issues/events{/number}","events_url":"https://api.github.com/repos/syssi/python-mirobo/events","assignees_url":"https://api.github.com/repos/syssi/python-mirobo/assignees{/user}","branches_url":"https://api.github.com/repos/syssi/python-mirobo/branches{/branch}","tags_url":"https://api.github.com/repos/syssi/python-mirobo/tags","blobs_url":"https://api.github.com/repos/syssi/python-mirobo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syssi/python-mirobo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syssi/python-mirobo/git/refs{/sha}","trees_url":"https://api.github.com/repos/syssi/python-mirobo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syssi/python-mirobo/statuses/{sha}","languages_url":"https://api.github.com/repos/syssi/python-mirobo/languages","stargazers_url":"https://api.github.com/repos/syssi/python-mirobo/stargazers","contributors_url":"https://api.github.com/repos/syssi/python-mirobo/contributors","subscribers_url":"https://api.github.com/repos/syssi/python-mirobo/subscribers","subscription_url":"https://api.github.com/repos/syssi/python-mirobo/subscription","commits_url":"https://api.github.com/repos/syssi/python-mirobo/commits{/sha}","git_commits_url":"https://api.github.com/repos/syssi/python-mirobo/git/commits{/sha}","comments_url":"https://api.github.com/repos/syssi/python-mirobo/comments{/number}","issue_comment_url":"https://api.github.com/repos/syssi/python-mirobo/issues/comments{/number}","contents_url":"https://api.github.com/repos/syssi/python-mirobo/contents/{+path}","compare_url":"https://api.github.com/repos/syssi/python-mirobo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syssi/python-mirobo/merges","archive_url":"https://api.github.com/repos/syssi/python-mirobo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syssi/python-mirobo/downloads","issues_url":"https://api.github.com/repos/syssi/python-mirobo/issues{/number}","pulls_url":"https://api.github.com/repos/syssi/python-mirobo/pulls{/number}","milestones_url":"https://api.github.com/repos/syssi/python-mirobo/milestones{/number}","notifications_url":"https://api.github.com/repos/syssi/python-mirobo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syssi/python-mirobo/labels{/name}","releases_url":"https://api.github.com/repos/syssi/python-mirobo/releases{/id}","deployments_url":"https://api.github.com/repos/syssi/python-mirobo/deployments","created_at":"2017-07-23T20:01:06Z","updated_at":"2017-08-08T17:32:22Z","pushed_at":"2017-11-26T18:31:08Z","git_url":"git://github.com/syssi/python-mirobo.git","ssh_url":"git@github.com:syssi/python-mirobo.git","clone_url":"https://github.com/syssi/python-mirobo.git","svn_url":"https://github.com/syssi/python-mirobo","homepage":null,"size":296,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"rytilahti:master","ref":"master","sha":"fc9c4c6e618fcbc8a505871799941aef4a9bec2e","user":{"login":"rytilahti","id":3705853,"avatar_url":"https://avatars3.githubusercontent.com/u/3705853?v=4","gravatar_id":"","url":"https://api.github.com/users/rytilahti","html_url":"https://github.com/rytilahti","followers_url":"https://api.github.com/users/rytilahti/followers","following_url":"https://api.github.com/users/rytilahti/following{/other_user}","gists_url":"https://api.github.com/users/rytilahti/gists{/gist_id}","starred_url":"https://api.github.com/users/rytilahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rytilahti/subscriptions","organizations_url":"https://api.github.com/users/rytilahti/orgs","repos_url":"https://api.github.com/users/rytilahti/repos","events_url":"https://api.github.com/users/rytilahti/events{/privacy}","received_events_url":"https://api.github.com/users/rytilahti/received_events","type":"User","site_admin":false},"repo":{"id":83989500,"name":"python-miio","full_name":"rytilahti/python-miio","owner":{"login":"rytilahti","id":3705853,"avatar_url":"https://avatars3.githubusercontent.com/u/3705853?v=4","gravatar_id":"","url":"https://api.github.com/users/rytilahti","html_url":"https://github.com/rytilahti","followers_url":"https://api.github.com/users/rytilahti/followers","following_url":"https://api.github.com/users/rytilahti/following{/other_user}","gists_url":"https://api.github.com/users/rytilahti/gists{/gist_id}","starred_url":"https://api.github.com/users/rytilahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rytilahti/subscriptions","organizations_url":"https://api.github.com/users/rytilahti/orgs","repos_url":"https://api.github.com/users/rytilahti/repos","events_url":"https://api.github.com/users/rytilahti/events{/privacy}","received_events_url":"https://api.github.com/users/rytilahti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rytilahti/python-miio","description":"Python library & console tool for controlling Xiaomi smart appliances","fork":false,"url":"https://api.github.com/repos/rytilahti/python-miio","forks_url":"https://api.github.com/repos/rytilahti/python-miio/forks","keys_url":"https://api.github.com/repos/rytilahti/python-miio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rytilahti/python-miio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rytilahti/python-miio/teams","hooks_url":"https://api.github.com/repos/rytilahti/python-miio/hooks","issue_events_url":"https://api.github.com/repos/rytilahti/python-miio/issues/events{/number}","events_url":"https://api.github.com/repos/rytilahti/python-miio/events","assignees_url":"https://api.github.com/repos/rytilahti/python-miio/assignees{/user}","branches_url":"https://api.github.com/repos/rytilahti/python-miio/branches{/branch}","tags_url":"https://api.github.com/repos/rytilahti/python-miio/tags","blobs_url":"https://api.github.com/repos/rytilahti/python-miio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rytilahti/python-miio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rytilahti/python-miio/git/refs{/sha}","trees_url":"https://api.github.com/repos/rytilahti/python-miio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rytilahti/python-miio/statuses/{sha}","languages_url":"https://api.github.com/repos/rytilahti/python-miio/languages","stargazers_url":"https://api.github.com/repos/rytilahti/python-miio/stargazers","contributors_url":"https://api.github.com/repos/rytilahti/python-miio/contributors","subscribers_url":"https://api.github.com/repos/rytilahti/python-miio/subscribers","subscription_url":"https://api.github.com/repos/rytilahti/python-miio/subscription","commits_url":"https://api.github.com/repos/rytilahti/python-miio/commits{/sha}","git_commits_url":"https://api.github.com/repos/rytilahti/python-miio/git/commits{/sha}","comments_url":"https://api.github.com/repos/rytilahti/python-miio/comments{/number}","issue_comment_url":"https://api.github.com/repos/rytilahti/python-miio/issues/comments{/number}","contents_url":"https://api.github.com/repos/rytilahti/python-miio/contents/{+path}","compare_url":"https://api.github.com/repos/rytilahti/python-miio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rytilahti/python-miio/merges","archive_url":"https://api.github.com/repos/rytilahti/python-miio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rytilahti/python-miio/downloads","issues_url":"https://api.github.com/repos/rytilahti/python-miio/issues{/number}","pulls_url":"https://api.github.com/repos/rytilahti/python-miio/pulls{/number}","milestones_url":"https://api.github.com/repos/rytilahti/python-miio/milestones{/number}","notifications_url":"https://api.github.com/repos/rytilahti/python-miio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rytilahti/python-miio/labels{/name}","releases_url":"https://api.github.com/repos/rytilahti/python-miio/releases{/id}","deployments_url":"https://api.github.com/repos/rytilahti/python-miio/deployments","created_at":"2017-03-05T17:41:43Z","updated_at":"2017-11-26T13:11:52Z","pushed_at":"2017-11-26T18:31:37Z","git_url":"git://github.com/rytilahti/python-miio.git","ssh_url":"git@github.com:rytilahti/python-miio.git","clone_url":"https://github.com/rytilahti/python-miio.git","svn_url":"https://github.com/rytilahti/python-miio","homepage":"","size":250,"stargazers_count":167,"watchers_count":167,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":18,"forks":42,"open_issues":18,"watchers":167,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/133"},"html":{"href":"https://github.com/rytilahti/python-miio/pull/133"},"issue":{"href":"https://api.github.com/repos/rytilahti/python-miio/issues/133"},"comments":{"href":"https://api.github.com/repos/rytilahti/python-miio/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rytilahti/python-miio/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/rytilahti/python-miio/statuses/73ec545e45d10983ac8572b9ed2d75f10c0e8ea4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"houndci-bot"}}