-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_Query.py
More file actions
27 lines (24 loc) · 1.04 KB
/
Copy pathtest_Query.py
File metadata and controls
27 lines (24 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from unittest import TestCase
from bo.Query import Query
from bo.Field import Field
class TestQuery(TestCase):
def test_generate_search_string(self):
query_name = 'test_query'
query_description = 'test query description'
input_field1 = Field('message', 'A128356')
input_field2 = Field('message', 'bbb')
query_inputs = [input_field1, input_field2]
query_outputs = []
query = Query(query_name, query_description, query_inputs, query_outputs)
search_string = query.generate_search_string()
self.assertEqual(search_string, '"A128356" "bbb" ')
def test_run(self):
query_name = 'test_query'
query_description = 'test query description'
input_field1 = Field('message', 'A128356')
input_field2 = Field('message', 'bbb')
query_inputs = [input_field1, input_field2]
query_outputs = []
query = Query(query_name, query_description, query_inputs, query_outputs)
query_result = query.run()
self.assertEqual(len(query_result), 1)