tests.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2015 The Distro Tracker Developers
  3. # See the COPYRIGHT file at the top-level directory of this distribution and
  4. # at http://deb.li/DTAuthors
  5. #
  6. # This file is part of Distro Tracker. It is subject to the license terms
  7. # in the LICENSE file found in the top-level directory of this
  8. # distribution and at http://deb.li/DTLicense. No part of Distro Tracker,
  9. # including this file, may be copied, modified, propagated, or distributed
  10. # except according to the terms contained in the LICENSE file.
  11. """
  12. Tests for Kali-specific modules/functionality of Distro Tracker.
  13. """
  14. from __future__ import unicode_literals
  15. import email.message
  16. from distro_tracker.test import SimpleTestCase
  17. from distro_tracker.vendor.kali.rules import classify_message
  18. class ClassifyMessageTests(SimpleTestCase):
  19. def setUp(self):
  20. self.message = email.message.Message()
  21. def run_classify(self, package=None, keyword=None):
  22. return classify_message(self.message, package, keyword)
  23. def test_classify_message_recognizes_rebuildd_logs(self):
  24. self.message['X-Rebuildd-Version'] = '0.4.1'
  25. self.message['X-Rebuildd-Host'] = 'foo.kali.org'
  26. self.message['Subject'] = ('[rebuildd] Log for failed build of '
  27. 'cisco-ocs_0.1-1kali1 on kali/i386')
  28. pkg, keyword = self.run_classify()
  29. self.assertEqual(pkg, 'cisco-ocs')
  30. self.assertEqual(keyword, 'build')