def setUp(self): super(ConfigApiTest, self).setUp() self.service = config_api.ConfigAPI() self.login_admin_endpoints_user() self.patcher_xsrf = mock.patch( '__main__.config_api.root_api.Service.check_xsrf_token') self.mock_xsrf = self.patcher_xsrf.start() self.existing_string_config_in_datastore = config_model.Config( id='test_config_string', string_value='test_config_value') self.existing_bool_config_in_datastore = config_model.Config( id='test_config_bool', bool_value=False) self.existing_int_config_in_datastore = config_model.Config( id='test_config_int', integer_value=7) self.existing_list_config_in_datastore = config_model.Config( id='test_config_list', list_value=['Group']) self.existing_string_config_in_datastore.put() self.existing_bool_config_in_datastore.put() self.existing_int_config_in_datastore.put() self.existing_list_config_in_datastore.put()
def setUp(self): super(ConfigurationTest, self).setUp() config_model.Config(id='string_config', string_value='config value 1').put() config_model.Config(id='integer_config', integer_value=1).put() config_model.Config(id='bool_config', bool_value=True).put() config_model.Config(id='list_config', list_value=['email1', 'email2']).put()
def setUp(self): super(ConfigurationTest, self).setUp() # Save the real modules for clean up. self.real_open = __builtin__.open self.real_file = __builtin__.file self.fs = fake_filesystem.FakeFilesystem() self.os = fake_filesystem.FakeOsModule(self.fs) self.open = fake_filesystem.FakeFileOpen(self.fs) self.stubs = mox3_stubout.StubOutForTesting() self.stubs.SmartSet(__builtin__, 'open', self.open) self.stubs.SmartSet(os, 'path', self.os.path) config_file = constants.CONFIG_DEFAULTS_PATH self.fs.CreateFile(config_file, contents=_config_defaults_yaml) config_model.Config(id='string_config', string_value='config value 1').put() config_model.Config(id='integer_config', integer_value=1).put() config_model.Config(id='bool_config', bool_value=True).put() config_model.Config(id='list_config', list_value=['email1', 'email2']).put()
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()
def test_heartbeat_assigned_device(self): """Tests heartbeat processing for an assigned, enrolled device.""" self.create_device( assigned_user='******'.format(loanertest.USER_DOMAIN)) config_model.Config(id='silent_onboarding', bool_value=True).put() response = self.service.heartbeat(self.chrome_request) self.assertIsInstance(response, chrome_messages.HeartbeatResponse) self.assertTrue(response.is_enrolled) self.assertTrue(response.start_assignment) self.assertTrue(response.silent_onboarding) device = device_model.Device.get(chrome_device_id=UNIQUE_ID) self.assertEqual(device.assigned_user, loanertest.USER_EMAIL) self.assertFalse(self.mock_loan_resumes_if_late.called)
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)
def setUp(self): super(FleetModelTest, self).setUp() self.config1 = config_model.Config( id='string_config', string_value='config value 1').put() self.config2 = config_model.Config(id='integer_config', integer_value=1).put()