def get_atomic_group_control_file(): """ Gets the control file to apply the atomic group for a set of machines """ return rpc_utils.lazy_load( os.path.join(os.path.dirname(__file__), 'set_atomic_group_control.srv'))
def test_lazy_load(self): self.god.stub_function(utils, 'read_file') DUMMY_PATH_1 = object() DUMMY_PATH_2 = object() DUMMY_FILE_1 = object() DUMMY_FILE_2 = object() utils.read_file.expect_call(DUMMY_PATH_1).and_return(DUMMY_FILE_1) self.assertEqual(DUMMY_FILE_1, rpc_utils.lazy_load(DUMMY_PATH_1)) self.god.check_playback() # read_file should not be called again for this path self.assertEqual(DUMMY_FILE_1, rpc_utils.lazy_load(DUMMY_PATH_1)) self.god.check_playback() # new file; read_file must be called again utils.read_file.expect_call(DUMMY_PATH_2).and_return(DUMMY_FILE_2) self.assertEqual(DUMMY_FILE_2, rpc_utils.lazy_load(DUMMY_PATH_2)) self.god.check_playback()
def get_atomic_group_control_file(): """ Gets the control file to apply the atomic group for a set of machines """ return rpc_utils.lazy_load(os.path.join(os.path.dirname(__file__), 'set_atomic_group_control.srv'))