Exemple #1
0
    def test_getCompatiblePlatforms(self):
        self.gConfigMock.getOptionsDict.return_value = {
            'OK': False,
            'Value': ''
        }
        res = getCompatiblePlatforms('plat')
        self.assertFalse(res['OK'])

        self.gConfigMock.getOptionsDict.return_value = {
            'OK': True,
            'Value': ''
        }
        res = getCompatiblePlatforms('plat')
        self.assertFalse(res['OK'])

        self.gConfigMock.getOptionsDict.return_value = {
            'OK': True,
            'Value': {
                'plat1': 'xOS1, xOS2,  xOS3',
                'plat2': 'sys2, xOS4, xOS5',
                'plat3': 'sys1, xOS1, xOS4'
            }
        }
        res = getCompatiblePlatforms('plat')
        self.assertTrue(res['OK'])
        self.assertEqual(res['Value'], ['plat'])

        res = getCompatiblePlatforms('plat1')
        self.assert_(res['OK'])
        self.assertEqual(res['Value'], ['plat1', 'xOS1', 'xOS2', 'xOS3'])
Exemple #2
0
def test_getCompatiblePlatforms(mocker, mockGCReplyInput, requested, expectedRes, expectedValue):
    mockGCReply.return_value = mockGCReplyInput

    mocker.patch("DIRAC.Interfaces.API.Dirac.gConfig.getOptionsDict", side_effect=mockGCReply)

    res = getCompatiblePlatforms(requested)
    assert res["OK"] is expectedRes, res
    if expectedRes:
        assert set(res["Value"]) == set(expectedValue), res["Value"]
Exemple #3
0
  def test_getCompatiblePlatforms( self ):
    self.gConfigMock.getOptionsDict.return_value = {'OK':False, 'Value':''}
    res = getCompatiblePlatforms( 'plat' )
    self.assertFalse( res['OK'] )

    self.gConfigMock.getOptionsDict.return_value = {'OK':True, 'Value':''}
    res = getCompatiblePlatforms( 'plat' )
    self.assertFalse( res['OK'] )

    self.gConfigMock.getOptionsDict.return_value = {'OK':True, 'Value':{'plat1': 'xOS1, xOS2,  xOS3',
                                                                        'plat2': 'sys2, xOS4, xOS5',
                                                                        'plat3': 'sys1, xOS1, xOS4'}}
    res = getCompatiblePlatforms( 'plat' )
    self.assertTrue( res['OK'] )
    self.assertEqual( res['Value'], ['plat'] )

    res = getCompatiblePlatforms( 'plat1' )
    self.assertTrue(res['OK'])
    self.assertEqual( res['Value'], ['plat1', 'xOS1', 'xOS2', 'xOS3'] )
Exemple #4
0
    def test_getCompatiblePlatforms(self):
        self.gConfigMock.getOptionsDict.return_value = {"OK": False, "Value": ""}
        res = getCompatiblePlatforms("plat")
        self.assertFalse(res["OK"])

        self.gConfigMock.getOptionsDict.return_value = {"OK": True, "Value": ""}
        res = getCompatiblePlatforms("plat")
        self.assertFalse(res["OK"])

        self.gConfigMock.getOptionsDict.return_value = {
            "OK": True,
            "Value": {"plat1": "xOS1, xOS2,  xOS3", "plat2": "sys2, xOS4, xOS5", "plat3": "sys1, xOS1, xOS4"},
        }
        res = getCompatiblePlatforms("plat")
        self.assertTrue(res["OK"])
        self.assertEqual(res["Value"], ["plat"])

        res = getCompatiblePlatforms("plat1")
        self.assert_(res["OK"])
        self.assertEqual(res["Value"], ["plat1", "xOS1", "xOS2", "xOS3"])