Beispiel #1
0
 def test_domain_error_non_actual_path_status(self):
     path_status = monitor.PathStatus(actual=False)
     domain_status = monitor.DomainStatus(error=Exception("domain"))
     status = monitor.Status(path_status, domain_status)
     self.assertTrue(status.actual)
     self.assertEqual(status.error, domain_status.error)
     self.assertFalse(status.valid)
Beispiel #2
0
 def test_path_error(self):
     path_status = monitor.PathStatus(error=Exception("path"))
     domain_status = monitor.DomainStatus()
     status = monitor.Status(path_status, domain_status)
     self.assertTrue(status.actual)
     self.assertEqual(status.error, path_status.error)
     self.assertFalse(status.valid)
Beispiel #3
0
 def test_both_error(self):
     # For backward compatibility we have to present single error.
     path_status = monitor.PathStatus(error=Exception("path"))
     domain_status = monitor.DomainStatus(error=Exception("domain"))
     status = monitor.Status(path_status, domain_status)
     self.assertTrue(status.actual)
     self.assertEqual(status.error, path_status.error)
     self.assertFalse(status.valid)
Beispiel #4
0
 def test_full_status(self):
     # Both path status and domain status are available.
     path_status = monitor.PathStatus()
     domain_status = monitor.DomainStatus()
     status = monitor.Status(path_status, domain_status)
     self.assertTrue(status.actual)
     self.assertIsNone(status.error)
     self.assertTrue(status.valid)
Beispiel #5
0
 def test_partial_status(self):
     # We collected path status but domain status is not available yet.
     path_status = monitor.PathStatus()
     domain_status = monitor.DomainStatus(actual=False)
     status = monitor.Status(path_status, domain_status)
     self.assertFalse(status.actual)
     self.assertIsNone(status.error)
     self.assertTrue(status.valid)
Beispiel #6
0
 def test_initial_status(self):
     # For backward compatibility, we must publish an initial status before
     # we collect the first samples. The initial status is marked as
     # actual=False to allow engine to treat it specially.
     path_status = monitor.PathStatus(actual=False)
     domain_status = monitor.DomainStatus(actual=False)
     status = monitor.Status(path_status, domain_status)
     self.assertFalse(status.actual)
     self.assertIsNone(status.error)
     self.assertTrue(status.valid)
Beispiel #7
0
 def test_readonly_attributes(self, attr, value):
     status = monitor.Status(monitor.PathStatus(), monitor.DomainStatus())
     self.assertEqual(value, getattr(status, attr))
     self.assertRaises(AttributeError, setattr, status, attr, "new")