コード例 #1
0
 def test_test_field(self):
     element = ResponseAssertion(test_field=TestField.REQUEST_DATA)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['ResponseAssertion'][
             'stringProp']:
         if tag['@name'] == 'Assertion.test_field':
             assert tag['#text'] == 'Assertion.request_data'
コード例 #2
0
 def test_custom_message(self):
     element = ResponseAssertion(custom_message="Mes")
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['ResponseAssertion'][
             'stringProp']:
         if tag['@name'] == 'Assertion.custom_message':
             assert tag['#text'] == 'Mes'
コード例 #3
0
 def test_scope1(self):
     element = ResponseAssertion(scope=Scope.MAIN_AND_SUB)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['ResponseAssertion'][
             'stringProp']:
         if tag['@name'] == 'Assertion.scope':
             assert tag['#text'] == 'all'
コード例 #4
0
 def test_scope2(self):
     element = ResponseAssertion(scope='var_name')
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     for tag in parsed_doc['test_result']['ResponseAssertion'][
             'stringProp']:
         if tag['@name'] == 'Assertion.scope':
             assert tag['#text'] == 'variable'
         if tag['@name'] == 'Scope.variable':
             assert tag['#text'] == 'var_name'
コード例 #5
0
 def test_positive2(self):
     ra = ResponseAssertion(test_type=TestType.MATCHES,
                            test_type_not=True)
     assert ra.test_type == "5"
コード例 #6
0
 def test_positive3(self):
     ra = ResponseAssertion(test_type=TestType.EQUALS,
                            test_type_or=True)
     assert ra.test_type == "40"
コード例 #7
0
 def test_positive(self):
     ResponseAssertion(test_field=TestField.DOCUMENT)
コード例 #8
0
 def test_positive(self):
     ra = ResponseAssertion(test_type=TestType.CONTAINS)
     assert ra.test_type == "2"
コード例 #9
0
 def test_positive(self):
     ResponseAssertion(test_type_or=True)
コード例 #10
0
 def test_check(self):
     with pytest.raises(TypeError):
         ResponseAssertion(custom_message=1)
コード例 #11
0
 def test_positive(self):
     ResponseAssertion(ignore_status=True)
コード例 #12
0
 def test_check(self):
     with pytest.raises(TypeError):
         ResponseAssertion(scope=1)
コード例 #13
0
 def test_positive4(self):
     ra = ResponseAssertion(test_type=TestType.SUBSTRING,
                            test_type_not=True,
                            test_type_or=True)
     assert ra.test_type == "52"
コード例 #14
0
 def test_ignore_status(self):
     element = ResponseAssertion(ignore_status=True)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     assert parsed_doc['test_result']['ResponseAssertion']['boolProp'][
         '#text'] == 'true'
コード例 #15
0
 def test_test_type(self):
     element = ResponseAssertion(test_type=TestType.CONTAINS)
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     assert parsed_doc['test_result']['ResponseAssertion']['intProp'][
         '#text'] == '2'
コード例 #16
0
 def test_patterns(self):
     element = ResponseAssertion(patterns=["Mes", "mes"])
     rendered_doc = element.to_xml()
     parsed_doc = xmltodict.parse(tag_wrapper(rendered_doc, 'test_result'))
     assert parsed_doc['test_result']['ResponseAssertion'][
         'collectionProp']['stringProp'][0]['#text'] == 'Mes'
コード例 #17
0
 def test_positive(self):
     ResponseAssertion(custom_message="Message")
コード例 #18
0
 def test_check2(self):
     with pytest.raises(TypeError):
         ResponseAssertion(ignore_status="True")
コード例 #19
0
 def test_positive(self):
     ResponseAssertion(scope='Name')
コード例 #20
0
 def test_check(self):
     with pytest.raises(TypeError):
         ResponseAssertion(test_type_not=1)
コード例 #21
0
 def test_positive1(self):
     ResponseAssertion(scope=Scope.MAIN)
コード例 #22
0
 def test_check2(self):
     with pytest.raises(TypeError):
         ResponseAssertion(test_type_or="True")
コード例 #23
0
 def test_check(self):
     with pytest.raises(TypeError):
         ResponseAssertion(
             test_field="Assertion.response_data_as_document")
コード例 #24
0
 def test_check(self):
     with pytest.raises(TypeError):
         ResponseAssertion(patterns="pats")
コード例 #25
0
 def test_positive(self):
     ResponseAssertion(patterns=["par"])