Esempio n. 1
0
 def test_send_payload_success_clears_existing_node_failure_count(
     self, mock_handle_receive, mock_send_document, mock_pod_preferences
 ):
     Node.create(host="sub.example.com", last_success=datetime.datetime.now(), failure_count=1)
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.failure_count == 0
Esempio n. 2
0
 def test_get_send_to_nodes_with_like_returns_nodes_for_post(self):
     Node.create(host="sub.example.com")
     save_post_metadata(DiasporaPost(guid="12345"), "diaspora",
                        ["sub.example.com"])
     nodes = get_send_to_nodes("*****@*****.**",
                               DiasporaLike(target_guid="12345"))
     assert nodes == ["sub.example.com"]
Esempio n. 3
0
 def test_send_payload_failure_updates_existing_node_failure_count(
     self, mock_handle_receive, mock_send_payload, mock_pod_preferences
 ):
     Node.create(host="sub.example.com", last_success=datetime.datetime.now())
     mock_send_payload.return_value = {"result": False, "https": False}
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.failure_count == 1
Esempio n. 4
0
 def test_send_payload_updates_existing_node_in_db(
     self, mock_handle_receive, mock_send_document, mock_pod_preferences
 ):
     Node.create(host="sub.example.com", last_success=datetime.datetime.now())
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.total_delivered == 1
     assert node.https
Esempio n. 5
0
 def test_send_payload_success_clears_existing_node_failure_count(
         self, mock_handle_receive, mock_send_document,
         mock_pod_preferences):
     Node.create(host="sub.example.com",
                 last_success=datetime.datetime.now(),
                 failure_count=1)
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.failure_count == 0
Esempio n. 6
0
 def test_send_payload_failure_updates_existing_node_failure_count(
         self, mock_handle_receive, mock_send_payload,
         mock_pod_preferences):
     Node.create(host="sub.example.com",
                 last_success=datetime.datetime.now())
     mock_send_payload.return_value = {"result": False, "https": False}
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.failure_count == 1
Esempio n. 7
0
 def test_send_payload_updates_existing_node_in_db(self,
                                                   mock_handle_receive,
                                                   mock_send_document,
                                                   mock_pod_preferences):
     Node.create(host="sub.example.com",
                 last_success=datetime.datetime.now())
     process(Mock())
     node = Node.get(Node.host == "sub.example.com")
     assert node.total_delivered == 1
     assert node.https
Esempio n. 8
0
 def test_get_send_to_nodes_with_like_returns_no_nodes_for_unknown_post(self):
     Node.create(host="sub.example.com")
     save_post_metadata(DiasporaPost(guid="12345"), "diaspora", ["sub.example.com"])
     nodes = get_send_to_nodes("*****@*****.**", DiasporaLike(target_guid="54321"))
     assert nodes == []