Do not assume the existence of a global domain in test

pull/1040/head
Kieran R. Prasch 2019-05-15 16:54:12 -06:00 committed by Kieran Prasch
parent 2e022461af
commit d5f7289515
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 10 additions and 8 deletions

View File

@ -703,8 +703,8 @@ class Learner:
unresponsive_nodes = set()
try:
# TODO: Streamline path generation
certificate_filepath = self.node_storage.generate_certificate_filepath(
checksum_address=current_teacher.checksum_public_address)
certificate_filepath = self.node_storage.generate_certificate_filepath(checksum_address=current_teacher.checksum_public_address)
response = self.network_middleware.get_nodes_via_rest(node=current_teacher,
nodes_i_need=self._node_ids_to_learn_about_immediately,
announce_nodes=announce_nodes,

View File

@ -8,9 +8,10 @@ def test_learner_learns_about_domains_separately(ursula_federated_test_config, c
ursula_config=ursula_federated_test_config,
quantity=3,
know_each_other=True)
global_learners = lonely_ursula_maker()
first_domain_learners = lonely_ursula_maker(domains=set([b"nucypher1.test_suite"]))
second_domain_learners = lonely_ursula_maker(domains=set([b"nucypher2.test_suite"]))
global_learners = lonely_ursula_maker(domains={b"nucypher1.test_suite"})
first_domain_learners = lonely_ursula_maker(domains={b"nucypher1.test_suite"})
second_domain_learners = lonely_ursula_maker(domains={b"nucypher2.test_suite"})
big_learner = global_learners.pop()
@ -24,10 +25,11 @@ def test_learner_learns_about_domains_separately(ursula_federated_test_config, c
big_learner._current_teacher_node = second_domain_learners.pop()
big_learner.learn_from_teacher_node()
assert len(big_learner.known_nodes) == 8
# All domain 1 nodes
assert len(big_learner.known_nodes) == 5
new_first_domain_learner = lonely_ursula_maker(domains=set([b"nucypher1.test_suite"])).pop()
new_second_domain_learner = lonely_ursula_maker(domains=set([b"nucypher2.test_suite"]))
new_first_domain_learner = lonely_ursula_maker(domains={b"nucypher1.test_suite"}).pop()
new_second_domain_learner = lonely_ursula_maker(domains={b"nucypher2.test_suite"})
new_first_domain_learner._current_teacher_node = big_learner
new_first_domain_learner.learn_from_teacher_node()