Exemple #1
0
 def setup(self):
     # this setup is way more verbose than normal
     # but we are forced to because this function needs a lot
     # passed in for remote execution. No other way around it.
     self.socket = Mock()
     self.socket.gethostname.return_value = 'hostname'
     self.fake_write = Mock(name='fake_write')
     self.fake_file = fakes.mock_open(data=self.fake_write)
     self.fake_file.readline.return_value = self.fake_file
     self.fake_file.readline.lstrip.return_value = ''
     self.distro = Mock()
     self.sprocess = Mock()
     self.paths = Mock()
     self.paths.mon.path = Mock(return_value='/cluster-hostname')
     self.logger = Mock()
     self.logger.info = self.logger.debug = lambda x: sys.stdout.write(str(x) + "\n")
Exemple #2
0
 def setup(self):
     # this setup is way more verbose than normal
     # but we are forced to because this function needs a lot
     # passed in for remote execution. No other way around it.
     self.socket = Mock()
     self.socket.gethostname.return_value = 'hostname'
     self.fake_write = Mock(name='fake_write')
     self.fake_file = fakes.mock_open(data=self.fake_write)
     self.fake_file.readline.return_value = self.fake_file
     self.fake_file.readline.lstrip.return_value = ''
     self.distro = Mock()
     self.sprocess = Mock()
     self.paths = Mock()
     self.paths.mon.path = Mock(return_value='/cluster-hostname')
     self.logger = Mock()
     self.logger.info = self.logger.debug = lambda x: sys.stdout.write(str(x) + "\n")
 def setup(self):
     self.fake_write = Mock(name='fake_write')
     self.fake_file = fakes.mock_open(data=self.fake_write)
     self.fake_file.readline.return_value = self.fake_file
Exemple #4
0
 def setup(self):
     self.fake_write = Mock(name='fake_write')
     self.fake_file = fakes.mock_open(data=self.fake_write)
     self.fake_file.readline.return_value = self.fake_file