{"action":"closed","issue":{"url":"https://api.github.com/repos/google/openhtf/issues/182","repository_url":"https://api.github.com/repos/google/openhtf","labels_url":"https://api.github.com/repos/google/openhtf/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/google/openhtf/issues/182/comments","events_url":"https://api.github.com/repos/google/openhtf/issues/182/events","html_url":"https://github.com/google/openhtf/issues/182","id":142543484,"number":182,"title":"Add phase unit test example with new conf","user":{"login":"wallacbe","id":14088001,"avatar_url":"https://avatars.githubusercontent.com/u/14088001?v=3","gravatar_id":"","url":"https://api.github.com/users/wallacbe","html_url":"https://github.com/wallacbe","followers_url":"https://api.github.com/users/wallacbe/followers","following_url":"https://api.github.com/users/wallacbe/following{/other_user}","gists_url":"https://api.github.com/users/wallacbe/gists{/gist_id}","starred_url":"https://api.github.com/users/wallacbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallacbe/subscriptions","organizations_url":"https://api.github.com/users/wallacbe/orgs","repos_url":"https://api.github.com/users/wallacbe/repos","events_url":"https://api.github.com/users/wallacbe/events{/privacy}","received_events_url":"https://api.github.com/users/wallacbe/received_events","type":"User","site_admin":false},"labels":[{"id":353223307,"url":"https://api.github.com/repos/google/openhtf/labels/documentation","name":"documentation","color":"b0b0b0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-22T04:09:37Z","updated_at":"2016-11-25T02:30:19Z","closed_at":"2016-11-25T02:30:19Z","body":"Old conf unit test method doesn't work:\n\n```\nimport unittest\nimport mock\nimport hello_world\nimport openhtf\n\nclass TestPhases(unittest.TestCase):\n\n  @mock.patch('openhtf.conf.Config', autospec=True)\n  @mock.patch.object(openhtf.exe, 'phase_data')\n  def test_hello_world(self, mock_test, mock_config):\n    hello_world.hello_world(mock_test)\n    mock_config.return_value.foo = 'bar'\n\nif __name__ == '__main__':\n  unittest.main()\n```\n\nRemoved the config mock decorator and used Load() instead.  Does this seem like a reasonable way  to mock the config?\n\n```\nimport unittest\nimport mock\nimport hello_world\nimport openhtf\n\nclass TestPhases(unittest.TestCase):\n\n  @mock.patch.object(openhtf.exe, 'phase_data')\n  def test_hello_world(self, mock_test):\n    openhtf.conf.Load(foo='bar')\n    hello_world.hello_world(mock_test)\n\nif __name__ == '__main__':\n  unittest.main()\n\n```\n"}}
{"actor":{"display_login":"fahhem"}}