Exemple #1
0
 def test_check_connection_ssh_is_none(self):
     """
     Passes a null ssh object to the check_connection method.
     The method should create a new ssh connection using the
     Connection object and return it.
     """
     self.stubs.Set(common, 'ssh_connect', fake_ssh_connect)
     ssh = common.check_connection(None, self.connection)
     self.assertIsNotNone(ssh)
Exemple #2
0
 def test_check_connection_ssh_is_none(self):
     """
     Passes a null ssh object to the check_connection method.
     The method should create a new ssh connection using the
     Connection object and return it.
     """
     self.stubs.Set(common, 'ssh_connect', fake_ssh_connect)
     ssh = common.check_connection(None, self.connection)
     self.assertIsNotNone(ssh)
Exemple #3
0
 def test_check_connection_transport_is_dead(self):
     """
     Passes an ssh object to the check_connection method which
     does not have a transport set.
     The method should create a new ssh connection using the
     Connection object and return it.
     """
     self.stubs.Set(common, 'ssh_connect', fake_ssh_connect)
     ssh1 = fake_ssh_connect(self.connection)
     ssh2 = common.check_connection(ssh1, self.connection)
     self.assertIsNotNone(ssh2)
     self.assertNotEqual(ssh1, ssh2)
Exemple #4
0
 def test_check_connection_transport_is_dead(self):
     """
     Passes an ssh object to the check_connection method which
     does not have a transport set.
     The method should create a new ssh connection using the
     Connection object and return it.
     """
     self.stubs.Set(common, 'ssh_connect', fake_ssh_connect)
     ssh1 = fake_ssh_connect(self.connection)
     ssh2 = common.check_connection(ssh1, self.connection)
     self.assertIsNotNone(ssh2)
     self.assertNotEqual(ssh1, ssh2)
Exemple #5
0
 def _set_connection(self):
     # create a new connection or verify an existing connection
     # and re-establish if the existing connection is dead
     self._connection = common.check_connection(self._connection,
                                                self.connection_data)
Exemple #6
0
 def _set_connection(self):
     # create a new connection or verify an existing connection
     # and re-establish if the existing connection is dead
     self._connection = common.check_connection(self._connection,
                                                self.connection_data)