Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 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}'
Ejemplo n.º 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'
Ejemplo n.º 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)'
Ejemplo n.º 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
Ejemplo n.º 9
0
 def test_data_source(self):
     with pytest.raises(TypeError):
         JdbcRequest(data_source=123)
Ejemplo n.º 10
0
 def test_parameter_types2(self):
     with pytest.raises(TypeError):
         JdbcRequest(parameter_types='123')
Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 13
0
 def test_is_enabled(self):
     with pytest.raises(TypeError):
         JdbcRequest(is_enabled=None)
Ejemplo n.º 14
0
 def test_name(self):
     with pytest.raises(TypeError):
         JdbcRequest(name=123)
Ejemplo n.º 15
0
 def test_query_timeout2(self):
     with pytest.raises(TypeError):
         JdbcRequest(query_timeout='123')
Ejemplo n.º 16
0
 def test_handle_result_set2(self):
     with pytest.raises(TypeError):
         JdbcRequest(handle_result_set=1)
Ejemplo n.º 17
0
 def test_result_variable_name(self):
     with pytest.raises(TypeError):
         JdbcRequest(result_variable_name=123)
Ejemplo n.º 18
0
 def test_query_timeout1(self):
     with pytest.raises(ValueError):
         JdbcRequest(query_timeout=-1)
Ejemplo n.º 19
0
 def test_variable_names(self):
     with pytest.raises(TypeError):
         JdbcRequest(variable_names=123)
Ejemplo n.º 20
0
 def test_comments(self):
     with pytest.raises(TypeError):
         JdbcRequest(comments=123)
Ejemplo n.º 21
0
 def test_parameter_values1(self):
     with pytest.raises(TypeError):
         JdbcRequest(parameter_values=123)
Ejemplo n.º 22
0
 def test_query(self):
     with pytest.raises(TypeError):
         JdbcRequest(query=123)
Ejemplo n.º 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