mirror of https://github.com/nucypher/nucypher.git
48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
"""
|
|
This file is part of nucypher.
|
|
|
|
nucypher is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
|
"""
|
|
import pytest
|
|
|
|
from tests.utils.middleware import MockRestMiddleware
|
|
from tests.utils.ursula import make_federated_ursulas
|
|
|
|
|
|
def test_new_federated_ursula_announces_herself(lonely_ursula_maker):
|
|
ursula_in_a_house, ursula_with_a_mouse = lonely_ursula_maker(quantity=2, domain="useless_domain")
|
|
|
|
# Neither Ursula knows about the other.
|
|
assert ursula_with_a_mouse not in ursula_in_a_house.known_nodes
|
|
assert ursula_in_a_house not in ursula_with_a_mouse.known_nodes
|
|
|
|
ursula_in_a_house.remember_node(ursula_with_a_mouse)
|
|
|
|
# OK, now, ursula_in_a_house knows about ursula_with_a_mouse, but not vice-versa.
|
|
assert ursula_with_a_mouse in ursula_in_a_house.known_nodes
|
|
assert ursula_in_a_house not in ursula_with_a_mouse.known_nodes
|
|
|
|
# But as ursula_in_a_house learns, she'll announce herself to ursula_with_a_mouse.
|
|
ursula_in_a_house.learn_from_teacher_node()
|
|
|
|
assert ursula_with_a_mouse in ursula_in_a_house.known_nodes
|
|
assert ursula_in_a_house in ursula_with_a_mouse.known_nodes
|
|
|
|
|
|
def test_node_deployer(federated_ursulas):
|
|
for ursula in federated_ursulas:
|
|
deployer = ursula.get_deployer()
|
|
assert deployer.options['https_port'] == ursula.rest_information()[0].port
|
|
assert deployer.application == ursula.rest_app
|