你的位置:Python学习 >> 资讯 >> 经验分享 >> 详细内容 在线投稿

Python MBT 测试用例

热度874票  浏览62次 时间:2011年7月19日 10:28

{.W.H E,Q1^zE^R0@Scenario(Param={Python学习)@p,J+}3~D;u.~;W

Python学习'j7[,Bg R1`5?!K6^9D

'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]

T#zWJ4m9v W^w0 Python学习!`jFjn"N Av

, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]Python学习[O(W\9N)w%~~+W

Python学习JY2y]W dp6]:BcCz

}, Where={'combine':['antiSpamLevel', 'actionForSpam'],Python学习.?1g8C+n:@cp;\#y

Python学习/O6`JjD1Mi6~

'strategy':'add'})Python学习{/Gd#p:n/] LW6z

Python学习p3U4O]g

def AntiSpamSetting(self):Python学习AQ y v/Og5{ S0|

d6E[!]B0{*i8q^0accessTarget = self.accessTarget

e in/NZ+\0 Python学习ja?#~Z)P.l

antiSpamLevel = self.Param['antiSpamLevel']

Kk3c`;`4U|0

}5~\`7Y0actionForSpam = self.Param['actionForSpam']Python学习7G)owM } F

Python学习&d.AOKJ

rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)

3v*eA&M6k`~ _z0

.w3^ jZ'@c.w0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

)k~$X[{#^m#C)o0 Python学习l z3V;rKf#^T

RspCheck(rsp, True, StatusCode.SYS_REQ_PARAM_INVALID if isSetFail else StatusCode.SYS_RESP_OK)

N8U%I1Wc-K5h#` flA0 Python学习,RJ-k0N.Xm+|8^

rsp = Filter.getAntiSpamSettings(accessTarget)Python学习:T[ zI;^$L5`?,O

%r'H1C2_;k'J7w@0if isSetFail:Python学习v-?5]{Wk1O-W)b@

Python学习:h^m"r,e#MjD(\

RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)

A-fC&PU5kA ^ r:[0

"l HM0N(\:IcnU0else:Python学习r{8Zi]!i.z2k k

Python学习|r^;xKe-d

RspCheck(rsp, False, StatusCode.SYS_RESP_OK)Python学习Ex*i%@m%h{X

Python学习\7c"IwDW i$_

Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')Python学习 KOe%T6Q e0j

Python学习]B TXB'hg(D c

Model View 结果:

gN3gi4\O `y0

-^&Q)XO.J"K6D0= 表示 “期望结果是”

3i3\8Cz-O O0

|5|9~ LKh q0AntiSpamSetting (antiSpamLevel:0) Running ...

*GR'N+OG6b0 Python学习4N zG+aj5WV(r;T

Passed: AntiSpamSettingPython学习g$y4RvLY

r\~X:k4fR0AntiSpamSetting1 (actionForSpam:delete) Running ...Python学习6q&S'UJ)y

P wr8GU&w&K0Passed: AntiSpamSettingPython学习%s)q;uY/i+LJLx

Python学习;bF7A5d cj;P x*e

AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习N8BW\d _tX3x

5kI$D'ld0Passed: AntiSpamSettingPython学习 WJ q:O!f|5Fp.`[D8h \

Python学习 ~;P"Nn4MD2lOpO

AntiSpamSetting3 (antiSpamLevel:1) Running ...

.gk2Y3vq5?!b8W"a0

o;xi:d*G[Rcm&\,@0Passed: AntiSpamSetting

mbimM0 Python学习*lY/AiIjeU;}

AntiSpamSetting4 (antiSpamLevel:2) Running ...

J,S4K-R^0 Python学习)BnPM)w+P1f

Passed: AntiSpamSetting

0j [)WV O0

|*X0^'c5^-Sf)X0AntiSpamSetting5 (antiSpamLevel:3) Running ...Python学习#Tt-^ Ov1p6]NR

Y(H*d4N\0uW|9|0Passed: AntiSpamSettingPython学习{m'xi-t:h8]5C~

f }i"] {3YL*eh!Z0AntiSpamSetting6 (antiSpamLevel:-1) Running ...

fg5wDPl0

H^#V$iq G$R2V0Passed: AntiSpamSetting

$[3lo'o0zJL|0
顶:36 踩:52
对本文中的事件或人物打分:
当前平均分:-0.03 (271次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.21 (266次打分)
【已经有249人表态】
36票
感动
30票
路过
30票
高兴
28票
难过
31票
搞笑
26票
愤怒
34票
无聊
34票
同情
上一篇 下一篇