Пример #1
0
 def test_makes_python_no_ssh(self):
     conn = connection.Connection('localhost',
                                  sudo=False,
                                  eager=False,
                                  interpreter='python')
     conn_string = conn._make_connection_string('localhost',
                                                _needs_ssh=lambda x: False)
     assert conn_string == 'popen//python=python'
Пример #2
0
 def test_makes_sudo_python_with_ssh(self):
     conn = connection.Connection('localhost',
                                  sudo=True,
                                  eager=False,
                                  interpreter='python')
     conn_string = conn._make_connection_string('localhost',
                                                _needs_ssh=lambda x: True)
     assert conn_string == 'ssh=localhost//python=sudo python'
Пример #3
0
 def test_does_not_make_sudo_python_with_forced_sudo(self):
     conn = connection.Connection('localhost',
                                  sudo=True,
                                  eager=False,
                                  interpreter='python')
     conn_string = conn._make_connection_string('localhost',
                                                _needs_ssh=lambda x: False,
                                                use_sudo=False)
     assert conn_string == 'popen//python=python'
Пример #4
0
 def setup(self):
     self.conn = connection.Connection('localhost', sudo=True, eager=False)
     self.conn.gateway = FakeGateway()
Пример #5
0
 def test_does_need_sudo(self):
     self.execnet.receive.return_value = 'alfredo'
     conn = connection.Connection('localhost', sudo=True, eager=False)
     assert conn._detect_sudo(_execnet=self.execnet) is True
Пример #6
0
 def test_detects_python2(self):
     with patch.object(sys, 'version_info', (2, 7, 11)):
         conn = connection.Connection('localhost', sudo=False, eager=False)
         conn_string = conn._make_connection_string('localhost', _needs_ssh=lambda x: True)
         assert conn_string == 'ssh=localhost//python=python2'
Пример #7
0
 def test_detects_python3(self):
     with patch.object(sys, 'version_info', (3, 5, 1)):
         conn = connection.Connection('localhost', sudo=True, eager=False)
         conn_string = conn._make_connection_string('localhost', _needs_ssh=lambda x: False)
         assert conn_string == 'popen//python=sudo python3'