class_docstr: Test class for JSONParser
class_docstr_tok: ["Test","class","for","JSONParser"]
docstr: JSONParser - Optional top level keys
docstr_tok: ["JSONParser","-","Optional","top","level","keys"]
code: def test_optional_keys_json(self):
      """JSONParser - Optional top level keys"""
      options = {
          "schema": {
              "columns": {},
              "host": "string",
              "host-id": "integer",
              "ids": [],
              "name": "string",
              "results": {},
              "valid": "boolean",
          },
          "configuration": {
              "optional_top_level_keys": [
                  "host-id",
                  "ids",
                  "results",
                  "valid",
              ]
          },
      }
  
      record_data = json.dumps(
          {
              "columns": {"test-column": 1},
              "host": "unit-test-host-1",
              "name": "unit-test",
              "valid": "true",
          }
      )
  
      # get parsed data
      parser = JSONParser(options)
      assert_equal(parser.parse(record_data), True)
  
      expected_result = [
          {
              "columns": {"test-column": 1},
              "host": "unit-test-host-1",
              "host-id": 0,
              "ids": [],
              "name": "unit-test",
              "results": {},
              "valid": True,
          }
      ]
  
      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 18 for calling the TestJSONParser obj's underlying member method code with example usage: obj.test_optional_keys_json() without return types