コード例 #1
0
 def test_execute_with_access(self):
     with requests_mock.mock() as m:
         m.post(self.url,
                text='success',
                request_headers={'x-ha-access': 'password'})
         assis = ExecuteHomeAssistant(
             'key', self.default_data(extra_data={'access': 'password'}))
         assis.execute()
         self.assertTrue(m.called_once)
コード例 #2
0
 def test_execute_with_access_token(self):
     with requests_mock.mock() as m:
         m.post(self.url,
                text='success',
                request_headers={'Authorization': 'Bearer abcde12345'})
         assis = ExecuteHomeAssistant(
             'key',
             self.default_data(extra_data={'access_token': 'abcde12345'}))
         assis.execute()
         self.assertTrue(m.called_once)
コード例 #3
0
 def test_execute(self):
     with requests_mock.mock() as m:
         m.post(self.url, text='success')
         assis = ExecuteHomeAssistant('key', self.default_data())
         assis.execute()
         self.assertTrue(m.called_once)