def testGetSambaServiceNameFailsIfNoServiceFound(values): with mock.patch('OPSI.System.Posix.getServiceNames', mock.Mock(return_value=values)): with pytest.raises(RuntimeError): Posix.getSambaServiceName(staticFallback=False)
def testGetSambaServiceNameGettingFoundSambaServiceName( expectedName, services): with mock.patch('OPSI.System.Posix._SAMBA_SERVICE_NAME', None): with mock.patch('OPSI.System.Posix.getServiceNames', mock.Mock(return_value=services)): assert expectedName == Posix.getSambaServiceName()
def testGetSambaServiceNameGettingDefaultIfNothingElseParsed(): with mock.patch('OPSI.System.Posix.getServiceNames'): assert "blabla" == Posix.getSambaServiceName(default="blabla", staticFallback=False)