Skip to content

Commit

Permalink
updating unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandeivert committed Jun 8, 2017
1 parent 8f9b55b commit 3bdb55e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
32 changes: 18 additions & 14 deletions test/unit/conf/logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"schema": {
"key1": [],
"key2": "string",
"key3": "integer"
"key3": "integer",
"key9": "boolean",
"key10": {},
"key11": "float"
},
"configuration": {
"optional_top_level_keys": {
"key9": "boolean",
"key10": {},
"key11": "float"
}
"optional_top_level_keys": [
"key9",
"key10",
"key11"
]
}
},
"test_log_type_json_2": {
Expand All @@ -35,23 +38,24 @@
"test_log_type_json_nested_osquery": {
"parser": "json",
"schema": {
"name": "string",
"hostIdentifier": "string",
"action": "string",
"calendarTime": "string",
"unixTime": "integer",
"columns": {},
"action": "string",
"decorations": {
"role": "string",
"env": "string",
"cluster": "string",
"number": "integer"
}
},
"hostIdentifier": "string",
"log_type": "string",
"name": "string",
"unixTime": "integer"
},
"configuration": {
"optional_top_level_keys": {
"log_type": "string"
}
"optional_top_level_keys": [
"log_type"
]
}
},
"test_log_type_json_nested_with_data": {
Expand Down
20 changes: 12 additions & 8 deletions test/unit/stream_alert_rule_processor/test_json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,21 @@ def test_basic_json(self):
def test_optional_keys_json(self):
"""Parse JSON with optional top level keys"""
schema = {
'name': 'string',
'columns': {},
'host': 'string',
'columns': {}
'host-id': 'integer',
'ids': [],
'name': 'string',
'results': {},
'valid': 'boolean'
}
options = {
'optional_top_level_keys': {
'ids': [],
'results': {},
'host-id': 'integer',
'valid': 'boolean'
}
'optional_top_level_keys': [
'host-id',
'ids',
'results',
'valid'
]
}
data = json.dumps({
'name': 'unit-test',
Expand Down

0 comments on commit 3bdb55e

Please sign in to comment.