def test_prepareResults_sus_multiple(self): raw = [FakeAnswer("127.0.0.10"), FakeAnswer("127.0.0.11")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.0.0.10', '127.0.0.11']) self.assertEqual(results["summary"], "suspicious") self.assertEqual(results["status"], "caution")
def test_prepareResults_spam_multiple(self): raw = [FakeAnswer("127.0.0.2")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.0.0.2']) self.assertEqual(results["summary"], "spam") self.assertEqual(results["status"], "caution")
def test_prepareResults_excessive(self): raw = [FakeAnswer("127.255.255.255")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.255.255.255']) self.assertEqual(results["summary"], "excessive_usage") self.assertEqual(results["status"], "caution")
def test_prepareResults_failure4(self): raw = [FakeAnswer("127.255.255.254")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.255.255.254']) self.assertEqual(results["summary"], "internal_failure") self.assertEqual(results["status"], "caution")
def test_prepareResults_ok_multiple(self): raw = [FakeAnswer("127.0.0.0"), FakeAnswer("127.0.0.1")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.0.0.0', '127.0.0.1']) self.assertEqual(results["summary"], "harmless") self.assertEqual(results["status"], "ok")
def test_prepareResults_error(self): raw = [] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], []) self.assertEqual(results["summary"], "harmless") self.assertEqual(results["status"], "ok")
def test_prepareResults_threat(self): raw = [FakeAnswer("127.0.0.4")] results = spamhaus.prepareResults(raw) self.assertEqual(results["response"], ['127.0.0.4']) self.assertEqual(results["summary"], "malicious") self.assertEqual(results["status"], "threat")