Esempio n. 1
0
    def test_cmdb_search_host(self):
        mock_get_client_by_request.success = True
        self.assertTrue(
            query.cmdb_search_host(self.request, self.biz_bk_id,
                                   self.bk_supplier_account,
                                   self.bk_supplier_id)['result'])

        mock_get_client_by_request.success = False
        self.assertFalse(
            query.cmdb_search_host(self.request, self.biz_bk_id,
                                   self.bk_supplier_account,
                                   self.bk_supplier_id)['result'])
Esempio n. 2
0
def cc_search_host(request, project_id, supplier_account, supplier_id):
    project = Project.objects.get(id=project_id)
    if project.from_cmdb:
        return cmdb_search_host(request, project.bk_biz_id, supplier_account,
                                supplier_id)
    else:
        ctx = {
            'result': False,
            'message': 'cannot search host by project which is not from CMDB',
            'data': {},
            'code': -1
        }
        return JsonResponse(ctx)
Esempio n. 3
0
def cc_search_host(request, biz_cc_id, supplier_account, supplier_id):
    return cmdb_search_host(request, biz_cc_id, supplier_account, supplier_id)