コード例 #1
0
def feed(auth_token):
    """Create a Feed to use for testing"""
    cb = CBCloudAPI(url="https://defense-eap01.conferdeploy.net",
                    token=auth_token,
                    org_key="WNEXFKQ7")
    # Feed Creation
    feedinfo = {
        "name": "Temporary BAT Func Test Feed",
        "owner": "DevRel",
        "provider_url": "https://developer.carbonblack.com",
        "summary": "BAT functional test feed",
        "category": "None",
        "access": "private"
    }
    feed_dict = {"feedinfo": feedinfo, "reports": []}
    test_feed = cb.create(Feed, feed_dict)
    try:
        test_feed.save()
    except ServerError:
        for feed in cb.select(Feed):
            if feed.name == feedinfo["name"]:
                feed.delete()

        test_feed.save()
    yield test_feed
    delete_feed(auth_token, test_feed._info["id"])
コード例 #2
0
def _create_feed(auth_token):
    """Create a Feed to use for testing"""
    cb = CBCloudAPI(url="https://defense-eap01.conferdeploy.net",
                    token=auth_token,
                    org_key="WNEXFKQ7")
    # Feed Creation
    feedinfo = {
        "name": "Temporary BAT Load Test Feed",
        "owner": "DevRel",
        "provider_url": "https://developer.carbonblack.com",
        "summary": "BAT Load test feed",
        "category": "None",
        "access": "private"
    }
    feed_dict = {"feedinfo": feedinfo, "reports": []}
    feed = cb.create(Feed, feed_dict)
    feed.save()
    return feed._info