def test_last_check_result_true(self): team = generate_sample_model_tree('Team', self.session) service = Service(name="Example Service", team=team, check_name="ICMP IPv4 Check", host='127.0.0.1') self.session.add(service) round_obj = generate_sample_model_tree('Round', self.session) check_1 = Check(round=round_obj, service=service, result=False, output='Check exceeded time') self.session.add(check_1) check_2 = Check(round=round_obj, service=service, result=False, output='Check exceeded time') self.session.add(check_2) check_3 = Check(round=round_obj, service=service, result=True, output='Good output') self.session.add(check_3) self.session.commit() assert service.last_check_result() is True
def test_last_check_result_not_found(self): team = generate_sample_model_tree('Team', self.db) service = Service(name="Example Service", team=team, check_name="ICMP IPv4 Check", ip_address='127.0.0.1') self.db.save(service) assert service.last_check_result() is None
def test_last_check_result_not_found(self): team = generate_sample_model_tree('Team', self.session) service = Service(name="Example Service", team=team, check_name="ICMP IPv4 Check", host='127.0.0.1') self.session.add(service) self.session.commit() assert service.last_check_result() is None
def test_last_check_result_false(self): team = generate_sample_model_tree('Team', self.db) service = Service(name="Example Service", team=team, check_name="ICMP IPv4 Check", ip_address='127.0.0.1') self.db.save(service) round_obj = generate_sample_model_tree('Round', self.db) check_1 = Check(round=round_obj, service=service, result=True, output='Good output') self.db.save(check_1) check_2 = Check(round=round_obj, service=service, result=True, output='Good output') self.db.save(check_2) check_3 = Check(round=round_obj, service=service, result=False, output='Check exceeded time') self.db.save(check_3) assert service.last_check_result() is False