예제 #1
0
 def setUp(self):
     super(ChromeEndpointsTest, self).setUp()
     self.patcher_directory = mock.patch(
         '__main__.directory.DirectoryApiClient')
     self.mock_directoryclass = self.patcher_directory.start()
     self.mock_directoryclient = self.mock_directoryclass.return_value
     self.addCleanup(self.patcher_directory.stop)
     self.service = chrome_api.ChromeApi()
     self.login_endpoints_user()
     self.chrome_request = chrome_messages.HeartbeatRequest(
         device_id=UNIQUE_ID)
예제 #2
0
 def setUp(self):
     super(ChromeEndpointsTest, self).setUp()
     self.patcher_directory = mock.patch(
         '__main__.directory.DirectoryApiClient')
     self.mock_directoryclass = self.patcher_directory.start()
     self.mock_directoryclient = self.mock_directoryclass.return_value
     self.addCleanup(self.patcher_directory.stop)
     self.service = chrome_api.ChromeApi()
     self.login_endpoints_user()
     self.chrome_request = chrome_messages.HeartbeatRequest(
         device_id=UNIQUE_ID)
     config_model.Config(id='silent_onboarding', bool_value=False).put()
     # Set bootstrap to completed so that maintenance mode will not be invoked.
     config_model.Config.set('bootstrap_completed', True)
예제 #3
0
 def test_heartbeat_no_device_id(self):
     """Tests heartbeat without a request.device_id."""
     with self.assertRaisesRegexp(endpoints.BadRequestException,
                                  chrome_api._NO_DEVICE_ID_MSG):
         self.service.heartbeat(chrome_messages.HeartbeatRequest())
예제 #4
0
 def testHeartbeatRequest(self):
     chrome = chrome_messages.HeartbeatRequest(device_id='1')
     self.assertEqual(chrome.device_id, '1')