2018-11-04 19:23:11 +00:00
|
|
|
"""
|
|
|
|
This file is part of nucypher.
|
|
|
|
|
|
|
|
nucypher is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
nucypher is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
"""
|
2018-11-14 18:07:09 +00:00
|
|
|
|
2018-11-22 18:29:57 +00:00
|
|
|
import pytest_twisted as pt
|
|
|
|
import time
|
2018-09-20 19:51:41 +00:00
|
|
|
from twisted.internet import threads
|
2018-09-01 20:36:41 +00:00
|
|
|
|
2018-09-20 19:57:23 +00:00
|
|
|
from nucypher.characters.base import Learner
|
2018-11-22 18:29:57 +00:00
|
|
|
from nucypher.cli.main import nucypher_cli
|
2018-12-20 21:02:26 +00:00
|
|
|
from nucypher.config.node import NodeConfiguration
|
2018-11-22 18:29:57 +00:00
|
|
|
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD, MOCK_URSULA_STARTING_PORT
|
2018-09-20 19:51:41 +00:00
|
|
|
|
|
|
|
|
2018-11-22 18:29:57 +00:00
|
|
|
@pt.inlineCallbacks
|
|
|
|
def test_run_lone_federated_default_development_ursula(click_runner):
|
2018-12-20 18:32:34 +00:00
|
|
|
args = ('ursula', 'run',
|
|
|
|
'--federated-only', # Operating Mode
|
|
|
|
'--rest-port', MOCK_URSULA_STARTING_PORT, # Network Port
|
|
|
|
'--dev', # Run in development mode (ephemeral node)
|
|
|
|
'--debug', # Display log output; Do not attach console
|
|
|
|
'--dry-run' # Disable twisted reactor
|
|
|
|
)
|
2018-09-01 20:36:41 +00:00
|
|
|
|
2018-11-22 18:29:57 +00:00
|
|
|
result = yield threads.deferToThread(click_runner.invoke,
|
|
|
|
nucypher_cli, args,
|
|
|
|
catch_exceptions=False,
|
|
|
|
input=INSECURE_DEVELOPMENT_PASSWORD + '\n')
|
2018-10-03 04:06:11 +00:00
|
|
|
|
2018-09-20 19:57:23 +00:00
|
|
|
time.sleep(Learner._SHORT_LEARNING_DELAY)
|
2018-09-20 19:51:41 +00:00
|
|
|
assert result.exit_code == 0
|
2018-12-20 18:32:34 +00:00
|
|
|
assert "Running Ursula on 127.0.0.1:{}".format(MOCK_URSULA_STARTING_PORT)
|
2018-12-20 21:02:26 +00:00
|
|
|
|
|
|
|
reserved_ports = (NodeConfiguration.DEFAULT_REST_PORT, NodeConfiguration.DEFAULT_DEVELOPMENT_REST_PORT)
|
|
|
|
assert MOCK_URSULA_STARTING_PORT not in reserved_ports
|