示例#1
0
    def test_get_server_by_ilo_address_with_no_registered_servers(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        server = icsphelper.get_server_by_ilo_address('16.124.135.239')

        self.mock_connection.get.assert_called_once_with(
            '/rest/os-deployment-servers/?count=-1')

        self.assertIsNone(server)
示例#2
0
    def test_get_server_by_ilo_address_with_non_matching_result(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([DEFAULT_SERVER])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        server = icsphelper.get_server_by_ilo_address('16.124.135.255')

        self.mock_connection.get.assert_called_once_with(
            '/rest/os-deployment-servers/?count=-1')

        self.assertIsNone(server)
示例#3
0
    def test_should_fail_when_os_build_plan_not_found(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        plan = icsphelper.get_build_plan('RHEL 7.2 x64')

        self.mock_connection.get.assert_called_once_with(
            '/rest/index/resources?filter="name=\'RHEL%207.2%20x64\'"&category=osdbuildplan'
        )

        self.assertIsNone(plan)
示例#4
0
    def test_get_build_plan_with_non_matching_result(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([DEFAULT_BUILD_PLAN])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        plan = icsphelper.get_build_plan('BuildPlan')

        self.mock_connection.get.assert_called_once_with(
            '/rest/index/resources?filter="name=\'BuildPlan\'"&category=osdbuildplan'
        )

        self.assertIsNone(plan)
示例#5
0
    def test_get_server_by_serial_with_no_registered_servers(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        server = icsphelper.get_server_by_serial('000')

        self.mock_connection.get.assert_called_once_with(
            '/rest/index/resources?category=osdserver&query=\'osdServerSerialNumber:"000"\''
        )

        self.assertIsNone(server)
示例#6
0
    def test_get_server_by_serial_with_matching_result(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([DEFAULT_SERVER])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        server = icsphelper.get_server_by_serial('VCGYZ33007')

        expected = {'uri': '/rest/os-deployment-servers/123456'}
        self.mock_connection.get.assert_called_once_with(
            '/rest/index/resources?category=osdserver&query=\'osdServerSerialNumber:"VCGYZ33007"\''
        )

        self.assertEqual(server, expected)
示例#7
0
    def test_get_build_plan_with_matching_result(self):
        self.mock_connection.get.side_effect = [
            self.get_as_rest_collection([DEFAULT_BUILD_PLAN])
        ]

        icsphelper = ICspHelper(self.mock_connection)
        plan = icsphelper.get_build_plan('RHEL 7.2 x64')

        expected = {
            'name': 'RHEL 7.2 x64',
            'uri': '/rest/os-deployment-build-plans/222'
        }
        self.mock_connection.get.assert_called_once_with(
            '/rest/index/resources?filter="name=\'RHEL%207.2%20x64\'"&category=osdbuildplan'
        )

        self.assertEqual(plan, expected)