def test_event_initial_match_is_min_required_percentage_fail(self):
     first_event = dict_to_event(first_event_dict)
     second_event = dict_to_event(second_event_dict)
     second_event.is_sample_attribute_up = MagicMock()
     second_event.is_sample_attribute_up.side_effect = False
     match = event_initial_match(facts_relations=None,
                                 first_event=first_event,
                                 second_event=second_event,
                                 min_relation_appearance=None,
                                 max_focus=None,
                                 min_required_correlation_percentage=80.0)
     self.assertFalse(second_event.is_sample_attribute_up.called)
     self.assertFalse(match)
 def test_event_initial_match_is_min_required_percentage_success(self):
     first_event = dict_to_event(first_event_dict)
     second_event = dict_to_event(second_event_dict)
     second_event.is_sample_attribute_up = MagicMock()
     second_event.is_sample_attribute_up.return_value = False
     match = event_initial_match(facts_relations=None,
                                 first_event=first_event,
                                 second_event=second_event,
                                 min_relation_appearance=None,
                                 max_focus=None,
                                 min_required_correlation_percentage=45.0)
     self.assertTrue(second_event.is_sample_attribute_up.called)
     self.assertFalse(match)
 def test_event_initial_match_test_event_in_facts_relations_fail(
         self, test_event_in_facts_relations_mock, buy_mock):
     test_event_in_facts_relations_mock.return_value = (False, "some_key")
     first_event = dict_to_event(first_event_dict)
     second_event = dict_to_event(second_event_dict)
     second_event.is_sample_attribute_up = MagicMock()
     second_event.is_sample_attribute_up.return_value = True
     match = event_initial_match(
         facts_relations="fact_relations",
         first_event=first_event,
         second_event=second_event,
         min_relation_appearance="min_relation_appearance",
         max_focus="max_focus",
         min_required_correlation_percentage=45.0)
     self.assertFalse(buy_mock.called)
     self.assertFalse(match)