Beispiel #1
0
def _GetSheriffList():
  """Returns a list of sheriff names for all sheriffs in the datastore."""
  clt = SheriffConfigClient()
  subscriptions, err_msg = clt.List()
  if err_msg:
    raise InternalServerError(err_msg)
  return [s.name for s in subscriptions]
Beispiel #2
0
 def testList(self):
   clt = SheriffConfigClient()
   response_text = """
   {
     "subscriptions": [
       {
         "config_set": "projects/catapult",
         "revision": "c9d4943dc832e448f9786e244f918fdabc1e5303",
         "subscription": {
           "name": "Public Team1",
           "rotation_url": "https://some/url",
           "notification_email": "*****@*****.**",
           "bug_labels": [
             "Lable1",
             "Lable2"
           ],
           "bug_components": [
             "foo>bar"
           ],
           "visibility": "PUBLIC",
           "patterns": [
             {
               "glob": "Foo2/*/Bar2/*"
             },
             {
               "regex": ".*"
             }
           ]
         }
       }
     ]
   }
   """
   clt._session = self._Session(self._Response(True, response_text))
   expected = [
       Subscription(
           revision='c9d4943dc832e448f9786e244f918fdabc1e5303',
           name='Public Team1',
           rotation_url='https://some/url',
           notification_email='*****@*****.**',
           visibility=VISIBILITY.PUBLIC,
           bug_labels=['Lable1', 'Lable2'],
           bug_components=['foo>bar']
       ),
   ]
   self.assertEqual(clt.List(), (expected, None))