blob: 2e2f9576a1b87580a9d5d9ee3376765ad498bae1 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001'''
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07002Copyright 2013 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
adminbae64d82013-08-01 10:50:15 -07008
9 TestON is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 2 of the License, or
12 (at your option) any later version.
13
14 TestON is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
Jon Hall4ba53f02015-07-29 13:07:41 -070020 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070021
22
23'''
24class Assert :
25
26 def __init__(self) :
27 self.default = ''
28
29 def CASE1(self,main) :
30
Jon Hall4ba53f02015-07-29 13:07:41 -070031
adminbae64d82013-08-01 10:50:15 -070032 main.case("Using assert to verify the result")
33 main.step("Using assert_equal to verify the result is equivalent or not")
34 expect = main.TRUE
35 actual = main.TRUE
36 main.log.warn(main.response_parser('<real></real><imag>2</imag><__complex__>true</__complex__>', "json"))
37 utilities.assert_equals(expect=expect,actual=actual,onpass="expect is equal to actual",onfail="expect is not equal to actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070038
adminbae64d82013-08-01 10:50:15 -070039 main.step("Using assert_matches to verify the result matches or not")
40 expect = "Res(.*)"
41 actual = "Result"
42 utilities.assert_matches(expect=expect,actual=actual,onpass="expect is macthes to actual",onfail="expect is not matches to actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070043
adminbae64d82013-08-01 10:50:15 -070044 main.step("Using assert_greater to verify the result greater or not")
45 expect = 10
46 actual = 5
47 utilities.assert_greater(expect=actual,actual=expect,onpass="expect is greater than the actual",onfail="expect is not greater than the actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070048
adminbae64d82013-08-01 10:50:15 -070049 main.step("Using assert_lesser to verify the result lesser or not")
50 expect = 5
51 actual = 10
52 utilities.assert_lesser(expect=actual,actual=expect,onpass="expect is lesser than the actual",onfail="expect is not lesser than the actual")