@@ -0,0 +1,2134 @@
+#!/usr/bin/python%0A# Copyright 2014 The Chromium OS Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Unittests for trybot_patch_pool.%22%22%22%0A%0Afrom __future__ import print_function%0A%0Aimport sys%0A%0Aimport constants%0Asys.path.insert(0, constants.SOURCE_ROOT)%0Afrom chromite.buildbot import trybot_patch_pool%0Afrom chromite.lib import cros_test_lib%0Afrom chromite.lib import patch as cros_patch%0Afrom chromite.lib import patch_unittest%0A%0A%0Aclass FilterTests(patch_unittest.GitRepoPatchTestCase):%0A  %22%22%22Tests for all the various filters.%22%22%22%0A%0A  patch_kls = cros_patch.LocalPatch%0A%0A  def testChromiteFilter(self):%0A    %22%22%22Make sure the chromite filter works%22%22%22%0A    _, _, patch = self._CommonGitSetup()%0A    patch.project = constants.CHROMITE_PROJECT%0A    self.assertTrue(trybot_patch_pool.ChromiteFilter(patch))%0A    patch.project = 'foooo'%0A    self.assertFalse(trybot_patch_pool.ChromiteFilter(patch))%0A%0A  def testManifestFilters(self):%0A    %22%22%22Make sure the manifest filters work%22%22%22%0A    _, _, patch = self._CommonGitSetup()%0A%0A    patch.project = constants.CHROMITE_PROJECT%0A    self.assertFalse(trybot_patch_pool.ExtManifestFilter(patch))%0A    self.assertFalse(trybot_patch_pool.IntManifestFilter(patch))%0A    self.assertFalse(trybot_patch_pool.ManifestFilter(patch))%0A%0A    patch.project = constants.MANIFEST_PROJECT%0A    self.assertTrue(trybot_patch_pool.ExtManifestFilter(patch))%0A    self.assertFalse(trybot_patch_pool.IntManifestFilter(patch))%0A    self.assertTrue(trybot_patch_pool.ManifestFilter(patch))%0A%0A    patch.project = constants.MANIFEST_INT_PROJECT%0A    self.assertFalse(trybot_patch_pool.ExtManifestFilter(patch))%0A    self.assertTrue(trybot_patch_pool.IntManifestFilter(patch))%0A    self.assertTrue(trybot_patch_pool.ManifestFilter(patch))%0A%0A  def testBranchFilter(self):%0A    %22%22%22Make sure the branch filter works%22%22%22%0A    _, _, patch = self._CommonGitSetup()%0A%0A    self.assertFalse(trybot_patch_pool.BranchFilter('/,/asdf', patch))%0A    self.assertTrue(trybot_patch_pool.BranchFilter(%0A        patch.tracking_branch, patch))%0A%0A%0Aif __name__ == '__main__':%0A  cros_test_lib.main()%0A

add some unittests