Пример #1
0
 def test_query_timeout(self):
     element = JdbcRequest(query_timeout=500)
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'queryTimeout':
             assert tag['#text'] == '500'
Пример #2
0
 def test_data_source(self):
     element = JdbcRequest(data_source='data source test')
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'dataSource':
             assert tag['#text'] == 'data source test'
Пример #3
0
 def test_result_variable_name(self):
     element = JdbcRequest(result_variable_name='var name')
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'resultVariable':
             assert tag['#text'] == 'var name'
Пример #4
0
 def test_parameter_types(self):
     element = JdbcRequest(parameter_types=['varchar ', '    INTEGER'])
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'queryArgumentsTypes':
             assert tag['#text'] == 'VARCHAR,INTEGER'
Пример #5
0
 def test_parameter_values(self):
     element = JdbcRequest(parameter_values=['param-1', 'param-2'])
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'queryArguments':
             assert tag['#text'] == '${param-1},${param-2}'
Пример #6
0
 def test_handle_result_set(self):
     element = JdbcRequest(handle_result_set=ResultSetHandler.COUNT_RECORDS)
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'resultSetHandler':
             assert tag['#text'] == 'Count Records'
Пример #7
0
 def test_query_type(self):
     element = JdbcRequest(query_type=QueryType.AUTOCOMMIT)
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'queryType':
             assert tag['#text'] == 'AutoCommit(false)'
Пример #8
0
 def test_query(self):
     q = """
     select * from table
     where col = '1'""".strip()
     element = JdbcRequest(query=q)
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['JDBCSampler']['stringProp']:
         if tag['@name'] == 'query':
             assert tag['#text'] == q
Пример #9
0
 def test_data_source(self):
     with pytest.raises(TypeError):
         JdbcRequest(data_source=123)
Пример #10
0
 def test_parameter_types2(self):
     with pytest.raises(TypeError):
         JdbcRequest(parameter_types='123')
Пример #11
0
 def test_name(self):
     element = JdbcRequest(name='jdbc')
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['JDBCSampler']['@testname'] == 'jdbc'
Пример #12
0
 def test_is_enabled(self):
     element = JdbcRequest(is_enabled=False)
     rendered_doc = element.to_xml().replace('<hashTree />', '')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['JDBCSampler']['@enabled'] == 'false'
Пример #13
0
 def test_is_enabled(self):
     with pytest.raises(TypeError):
         JdbcRequest(is_enabled=None)
Пример #14
0
 def test_name(self):
     with pytest.raises(TypeError):
         JdbcRequest(name=123)
Пример #15
0
 def test_query_timeout2(self):
     with pytest.raises(TypeError):
         JdbcRequest(query_timeout='123')
Пример #16
0
 def test_handle_result_set2(self):
     with pytest.raises(TypeError):
         JdbcRequest(handle_result_set=1)
Пример #17
0
 def test_result_variable_name(self):
     with pytest.raises(TypeError):
         JdbcRequest(result_variable_name=123)
Пример #18
0
 def test_query_timeout1(self):
     with pytest.raises(ValueError):
         JdbcRequest(query_timeout=-1)
Пример #19
0
 def test_variable_names(self):
     with pytest.raises(TypeError):
         JdbcRequest(variable_names=123)
Пример #20
0
 def test_comments(self):
     with pytest.raises(TypeError):
         JdbcRequest(comments=123)
Пример #21
0
 def test_parameter_values1(self):
     with pytest.raises(TypeError):
         JdbcRequest(parameter_values=123)
Пример #22
0
 def test_query(self):
     with pytest.raises(TypeError):
         JdbcRequest(query=123)
Пример #23
0
 def test_hashtree_contain(self):
     element = JdbcRequest(name='Jdbc',
                           handle_result_set=ResultSetHandler.COUNT_RECORDS,
                           query_timeout=20)
     rendered_doc = element.to_xml()
     assert '<hashTree />' in rendered_doc