Exemple #1
0
def ldslist(args):

    path = inspect.getframeinfo(inspect.currentframe()).function
    thread = Analytics().async_send_analytics(path=path, debug=args.debug)

    fetch = LdsFetch()
    queryresult = QueryResult("ldslist")

    checkFilterArgs(args, queryresult)
    (_, jsonObj) = fetch.fetchCPCodeProducts(edgerc=args.edgerc,
                                             section=args.section,
                                             account_key=args.account_key,
                                             debug=args.debug)

    thread.join()
    return handleresponse(args, jsonObj, queryresult, Debug=args.debug)
Exemple #2
0
    def testFetchCPCodeProducts(self, mockSessionObj):

        response = MockResponse()
        response.status_code = 200

        fetch = LdsFetch()

        response.jsonObj = fetch.adjustResponseJSON(
            self.getJSONFromFile(
                "{}/bin/tests/json/_lds-api_v3_log-sources_cpcode-products.json"
                .format(os.getcwd())))

        session = mockSessionObj()
        session.get.return_value = response

        #updade tests
        fetch = LdsFetch()
        edgeRc = "{}/bin/tests/other/.dummy_edgerc".format(os.getcwd())

        (code, json) = fetch.fetchCPCodeProducts(edgerc=edgeRc,
                                                 section=None,
                                                 account_key=None)
        self.assertEqual(response.status_code, code)
        self.runParseElement(json)