Example #1
0
 def test_warn_if_port_is_in_use(self, mock_warn, mock_port, mock_run):
     mock_port.return_value = 1010
     env.host = 'any_host'
     mock_run.return_value = 'some_string'
     server.is_port_in_use(env.host)
     mock_warn.assert_called_with('Server failed to start on any_host. '
                                  'Port 1010 already in use')
Example #2
0
 def test_fail_if_port_is_in_use(self, mock_error, mock_port, mock_run):
     mock_port.return_value = 1010
     env.host = 'any_host'
     mock_run.return_value = 'some_string'
     server.is_port_in_use(env.host)
     mock_error.assert_called_with('Server failed to start on any_host. '
                                   'Port 1010 already in use')
Example #3
0
 def test_no_warn_if_port_lookup_fail(self, mock_warn, mock_port):
     e = ConfigurationError()
     mock_port.side_effect = e
     env.host = 'any_host'
     self.assertFalse(server.is_port_in_use(env.host))
     self.assertEqual(False, mock_warn.called)
Example #4
0
 def test_no_warn_if_port_free(self, mock_warn, mock_port, mock_run):
     mock_port.return_value = 1010
     env.host = 'any_host'
     mock_run.return_value = ''
     server.is_port_in_use(env.host)
     self.assertEqual(False, mock_warn.called)
Example #5
0
 def test_no_warn_if_port_lookup_fail(self, mock_warn, mock_port):
     e = ConfigurationError()
     mock_port.side_effect = e
     env.host = 'any_host'
     self.assertFalse(server.is_port_in_use(env.host))
     self.assertEqual(False, mock_warn.called)
Example #6
0
 def test_no_warn_if_port_free(self, mock_warn, mock_port, mock_run):
     mock_port.return_value = 1010
     env.host = 'any_host'
     mock_run.return_value = ''
     server.is_port_in_use(env.host)
     self.assertEqual(False, mock_warn.called)