class_docstr: Test class for JSONParser
class_docstr_tok: ["Test","class","for","JSONParser"]
docstr: JSONParser - Cloudtrail JSON
docstr_tok: ["JSONParser","-","Cloudtrail","JSON"]
code: def test_cloudtrail(self):
      """JSONParser - Cloudtrail JSON"""
      options = {
          "schema": {
              "eventVersion": "string",
              "eventID": "string",
              "eventTime": "string",
              "requestParameters": {},
              "eventType": "string",
              "responseElements": "string",
              "awsRegion": "string",
              "eventName": "string",
              "userIdentity": {},
              "eventSource": "string",
              "requestID": "string",
              "userAgent": "string",
              "sourceIPAddress": "string",
              "recipientAccountId": "string",
          },
          "configuration": {"json_path": "Records[*]"},
      }
  
      data = {
          "Records": [
              {
                  "eventVersion": "1.0.0",
                  "eventID": "0000000",
                  "eventTime": "2016-12-31T12:00:00Z",
                  "requestParameters": {"streamName": "streamalert"},
                  "eventType": "AwsApiCall",
                  "responseElements": None,
                  "awsRegion": "us-west-1",
                  "eventName": "DescribeStream",
                  "userIdentity": {
                      "userName": "streamalert_user",
                      "principalId": "AAAAAAAAAAAAAAAA",
                      "accessKeyId": "FFFFFFFFFFFFFFFFFF",
                      "type": "IAMUser",
                      "arn": "arn:aws:iam::111111111111:user/streamalert_user",
                      "accountId": "111111111111",
                  },
                  "eventSource": "kinesis.amazonaws.com",
                  "requestID": "dddddddddd",
                  "userAgent": "aws-sdk",
                  "sourceIPAddress": "127.0.0.1",
                  "recipientAccountId": "1111111111111",
              },
              {
                  "eventVersion": "2.0.0",
                  "eventID": "1111111",
                  "eventTime": "2017-01-31T12:00:00Z",
                  "requestParameters": {
                      "streamName": "streamalert_prod"
                  },
                  "eventType": "AwsApiCall",
                  "responseElements": None,
                  "awsRegion": "us-east-1",
                  "eventName": "DescribeStream",
                  "userIdentity": {
                      "userName": "streamalert_prod_user",
                      "principalId": "BBBBBBBBBBBBBBBB",
                      "accessKeyId": "GGGGGGGGGGGGGGGG",
                      "type": "IAMUser",
                      "arn": "arn:aws:iam::222222222222:user/streamalert_prod_user",
                      "accountId": "222222222222",
                  },
                  "eventSource": "kinesis.amazonaws.com",
                  "requestID": "dddddddddd",
                  "userAgent": "aws-sdk",
                  "sourceIPAddress": "127.0.0.2",
                  "recipientAccountId": "222222222222",
              },
          ]
      }
  
      record_data = json.dumps(data)
  
      # get parsed data
      parser = JSONParser(options)
      assert_equal(parser.parse(record_data), True)
  
      expected_result = data["Records"]
  
      assert_equal(parser.parsed_records, expected_result)
  
imports: import json
  from mock import patch
  from nose.tools import assert_equal
  from streamalert.classifier.parsers import JSONParser
label_desc: Use image node_id 21 for calling the TestJSONParser obj's underlying member method code with example usage: obj.test_cloudtrail() without return types