Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,12 @@ def _getDNs(self, certGroupName):
usersString = gConfig.getValue('/Registry/Groups/' + certGroupName + '/Users')
usersInGroup = usersString.split(',')
DNs = [gConfig.getValue('/Registry/Users/' + user + '/DN') for user in usersInGroup]
return S_OK(DNs)
except AttributeError:
return S_ERROR('Some error occured while getting the DNs.')
if (DNs == [None]):
return S_ERROR('Users in this group don`t have DN ')
else:
return S_OK(DNs)
except AttributeError as ae:
gLogger.exception("Error occured while getting the DNs", lException=ae)

def _getPilotOptionsPerSetup(self, setup, pilotDict):
""" Given a setup, returns its pilot options in a dictionary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ def setUp(self):
}
}
}
Resources
{
Sites
{

}
}
Systems
{
WorkloadManagement
Expand Down Expand Up @@ -69,6 +76,10 @@ def setUp(self):
CA = /DC=ch/DC=voodo/CN=Voodo Grid Certification Authority
Email = franek.bolek@voodo.pl
}
Nemo
{

}
}
Groups
{
Expand All @@ -83,6 +94,14 @@ def setUp(self):
#@@-ggg@diracAdmin - 2015-07-07 13:40:55
VO = lhcb
}
Empty_group
{

}
Nautilus
{
Users=Nemo
}
}
}
'''
Expand Down Expand Up @@ -129,6 +148,16 @@ def test_failure(self):
res = synchroniser._getDNs('nonExistingGroup')
self.assertFalse(res['OK'])

def test_empty_group(self):
synchronizer = PilotCStoJSONSynchronizer()
res = synchronizer._getDNs('Empty')
self.assertFalse(res['OK'])

def test_user_without_DN(self):
synchronizer = PilotCStoJSONSynchronizer()
res = synchronizer._getDNs('Nautilus')
self.assertFalse(res['OK'])


if __name__ == '__main__':
suite = unittest.defaultTestLoader.loadTestsFromTestCase(PilotCStoJSONSynchronizerTestCase)
Expand Down