def test_find_owners_with_no_dep_defined(self, *args):
     """
 Test on _find_owners with non-defined dep.
 Expect: through out KeyErrors. The primary owner is None, an empty list of other owners.
 """
     owners_yaml = """
               deps:
                 dep0:
                   owners:
               """
     with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
         manager = JiraManager('url', 'username', 'password', owners_yaml)
         primary, owners = manager._find_owners('dep1')
         self.assertIsNone(primary)
         self.assertEqual(len(owners), 0)
 def test_find_owners_with_single_owner(self, *args):
     """
 Test on _find_owners with single owner
 Expect: the primary owner is 'owner0', an empty list of other owners.
 """
     owners_yaml = """
               deps:
                 dep0:
                   owners: owner0,
               """
     with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
         manager = JiraManager('url', 'username', 'password', owners_yaml)
         primary, owners = manager._find_owners('dep0')
         self.assertEqual(primary, 'owner0')
         self.assertEqual(len(owners), 0)
 def test_find_owners_with_no_owners_defined(self, *args):
   """
   Test on _find_owners without owner.
   Expect: the primary owner is None, an empty list of other owners.
   """
   owners_yaml = """
                 deps:
                   dep0:
                     owners:
                 """
   with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
     manager = JiraManager('url', 'username', 'password', owners_yaml)
     primary, owners = manager._find_owners('dep0')
     self.assertIsNone(primary)
     self.assertEqual(len(owners), 0)
 def test_find_owners_with_single_owner(self, *args):
   """
   Test on _find_owners with single owner
   Expect: the primary owner is 'owner0', an empty list of other owners.
   """
   owners_yaml = """
                 deps:
                   dep0:
                     owners: owner0,
                 """
   with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
     manager = JiraManager('url', 'username', 'password', owners_yaml)
     primary, owners = manager._find_owners('dep0')
     self.assertEqual(primary, 'owner0')
     self.assertEqual(len(owners), 0)
 def test_find_owners_with_multi_owners(self, *args):
     """
 Test on _find_owners with multiple owners.
 Expect: the primary owner is 'owner0', a list contains 'owner1' and 'owner2'.
 """
     owners_yaml = """
               deps:
                 dep0:
                   owners: owner0, owner1 , owner2,
               """
     with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
         manager = JiraManager('url', 'username', 'password', owners_yaml)
         primary, owners = manager._find_owners('dep0')
         self.assertEqual(primary, 'owner0')
         self.assertEqual(len(owners), 2)
         self.assertIn('owner1', owners)
         self.assertIn('owner2', owners)
 def test_find_owners_with_multi_owners(self, *args):
   """
   Test on _find_owners with multiple owners.
   Expect: the primary owner is 'owner0', a list contains 'owner1' and 'owner2'.
   """
   owners_yaml = """
                 deps:
                   dep0:
                     owners: owner0, owner1 , owner2,
                 """
   with patch('__builtin__.open', mock_open(read_data=owners_yaml)):
     manager = JiraManager('url', 'username', 'password', owners_yaml)
     primary, owners = manager._find_owners('dep0')
     self.assertEqual(primary, 'owner0')
     self.assertEqual(len(owners), 2)
     self.assertIn('owner1', owners)
     self.assertIn('owner2', owners)