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-16 22:01:40 +00:00
|
|
|
|
2018-10-25 19:52:08 +00:00
|
|
|
from nucypher.utilities.sandbox.ursula import make_federated_ursulas
|
2018-07-02 12:18:31 +00:00
|
|
|
|
2018-09-13 19:35:44 +00:00
|
|
|
|
2018-10-25 19:52:08 +00:00
|
|
|
def test_one_node_stores_a_bunch_of_others(federated_ursulas, ursula_federated_test_config):
|
2018-11-22 18:31:04 +00:00
|
|
|
the_chosen_seednode = list(federated_ursulas)[2] # ...neo?
|
2018-10-25 19:52:08 +00:00
|
|
|
seed_node = the_chosen_seednode.seed_node_metadata()
|
2018-11-22 18:31:04 +00:00
|
|
|
|
2018-10-25 19:52:08 +00:00
|
|
|
newcomer = make_federated_ursulas(
|
|
|
|
ursula_config=ursula_federated_test_config,
|
|
|
|
quantity=1,
|
|
|
|
know_each_other=False,
|
|
|
|
save_metadata=True,
|
|
|
|
seed_nodes=[seed_node]).pop()
|
|
|
|
|
|
|
|
assert not newcomer.known_nodes
|
2018-10-27 21:26:33 +00:00
|
|
|
|
2018-12-07 04:58:32 +00:00
|
|
|
newcomer.start_learning_loop(now=True)
|
2018-10-25 19:52:08 +00:00
|
|
|
|
2018-12-07 04:58:32 +00:00
|
|
|
assert list(newcomer.known_nodes)
|
|
|
|
assert len(list(newcomer.known_nodes)) == len(list(newcomer.node_storage.all(True)))
|
|
|
|
assert set(list(newcomer.known_nodes)) == set(list(newcomer.node_storage.all(True)))
|