Exemplo n.º 1
0
 def test_expect_null(self):
     element = JSONAssertion(expect_null=True)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion']['boolProp']:
         if tag['@name'] == 'EXPECT_NULL':
             assert tag['#text'] == 'true'
Exemplo n.º 2
0
 def test_validation(self):
     element = JSONAssertion(validation=True)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion']['boolProp']:
         if tag['@name'] == 'JSONVALIDATION':
             assert tag['#text'] == 'true'
Exemplo n.º 3
0
 def test_invert(self):
     element = JSONAssertion(invert=True)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion']['boolProp']:
         if tag['@name'] == 'INVERT':
             assert tag['#text'] == 'true'
Exemplo n.º 4
0
 def test_is_regex(self):
     element = JSONAssertion(is_regex=False)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion']['boolProp']:
         if tag['@name'] == 'ISREGEX':
             assert tag['#text'] == 'false'
Exemplo n.º 5
0
 def test_json_path(self):
     element = JSONAssertion(json_path="data[*].value")
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion'][
             'stringProp']:
         if tag['@name'] == 'JSON_PATH':
             assert tag['#text'] == "data[*].value"
Exemplo n.º 6
0
 def test_expected_value(self):
     element = JSONAssertion(expected_value="value")
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['JSONPathAssertion'][
             'stringProp']:
         if tag['@name'] == 'EXPECTED_VALUE':
             assert tag['#text'] == "value"
Exemplo n.º 7
0
 def test_check(self):
     with pytest.raises(TypeError):
         JSONAssertion(invert="True")
Exemplo n.º 8
0
 def test_positive(self):
     JSONAssertion(json_path="data[*].value")
Exemplo n.º 9
0
 def test_check(self):
     with pytest.raises(TypeError):
         JSONAssertion(json_path=1)
Exemplo n.º 10
0
 def test_check(self):
     with pytest.raises(TypeError):
         JSONAssertion(expected_value=1)
Exemplo n.º 11
0
 def test_positive(self):
     JSONAssertion(expected_value="value")
Exemplo n.º 12
0
 def test_positive(self):
     JSONAssertion(is_regex=True)
Exemplo n.º 13
0
 def test_check2(self):
     with pytest.raises(TypeError):
         JSONAssertion(is_regex=1)
Exemplo n.º 14
0
 def test_positive(self):
     JSONAssertion(invert=True)
Exemplo n.º 15
0
 def test_positive(self):
     JSONAssertion(expect_null=True)
Exemplo n.º 16
0
 def test_check2(self):
     with pytest.raises(TypeError):
         JSONAssertion(expect_null=1)
Exemplo n.º 17
0
 def test_positive(self):
     JSONAssertion(validation=True)
Exemplo n.º 18
0
 def test_check2(self):
     with pytest.raises(TypeError):
         JSONAssertion(validation=1)