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

Python MBT 测试用例

热度867票  浏览62次 时间:2011年7月19日 10:28
Python学习GK%}^bT

@Scenario(Param={Python学习LEtQ8G@1XQ%{2`

? B3tUI%P0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]Python学习^+O3H.K#]R

@{t7g.u(_1N0, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]Python学习+tb1Ez6T n

Python学习i/W2{$Z0w3XvE

}, Where={'combine':['antiSpamLevel', 'actionForSpam'],

vTvO,W0

%K$tMPg0'strategy':'add'})Python学习y'vbA,RX

Python学习&c@7Ks,n G,]Fp*Q2f

def AntiSpamSetting(self):Python学习#Y{(t%u(H{

Python学习 {6A*_6q/@1n;u7h4~V

accessTarget = self.accessTargetPython学习]-s^Q)ci d#a

? z2Ys1z(l8O bC0antiSpamLevel = self.Param['antiSpamLevel']

W'kHje!}0

#f)x2b,]2qJ"z0actionForSpam = self.Param['actionForSpam']

*Sw)pb/B.w:|]hg"x0 Python学习l8Yl+J _+v|T

rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)Python学习YC_*AE {tq

fB?&KddV#R0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

)m f#A0Fn@]`0 Python学习MAT TY"O

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

(Qnl%M"vq0

CC~$U$[$NiC0rsp = Filter.getAntiSpamSettings(accessTarget)Python学习k:m@Y K"Z

FX^s(E6Zo+U0if isSetFail:Python学习w h*o'lS^;dW3lu

-c2CUZ Q*]0RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)

u}o-?7C#r0 Python学习-m6wH3Or*a!R

else:Python学习.OJ3[!w)pq

Python学习zS`&h!L [H(vb

RspCheck(rsp, False, StatusCode.SYS_RESP_OK)Python学习P-JQ,`1P3C%p

:V5X _B A]c2O0Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')

w&QgXO0

XWrp'P+|!yH%Z0Model View 结果:

*F[*QgCPq+v0 Python学习tmsvqq9W

= 表示 “期望结果是”

Su+pnYhO0 Python学习1e,Lrf-u'n ]\*{ |

AntiSpamSetting (antiSpamLevel:0) Running ...

%`E&`/HB N0

FX1]_4_ \n7y3AO0Passed: AntiSpamSettingPython学习 V3C0r%Uu}B

Python学习3lu(M,tQ[(Uu

AntiSpamSetting1 (actionForSpam:delete) Running ...Python学习#eD]"Ps ??

Python学习@(w:?C'F3R5w1p4A(Z P#\$y

Passed: AntiSpamSetting

1Q Y R8f t L,lp5D0

cT/T`5r0AntiSpamSetting2 (actionForSpam:badAction) Running ...

"jq+G#G&Z7G0 Python学习T-uiGm+G6E

Passed: AntiSpamSettingPython学习:?!k l1B+q5]"Q ^a

Gcz1\@0AntiSpamSetting3 (antiSpamLevel:1) Running ...

Pn|3u%`Zzu[ R0

2bR'UUr`5i0Passed: AntiSpamSettingPython学习5_I7q}!{)}

Python学习a0f6`#`,yB;cz\S

AntiSpamSetting4 (antiSpamLevel:2) Running ...

K(h)U.lw ~$\5C0 Python学习*T!e1EAX

Passed: AntiSpamSetting

,p?'O:lxc1obK0

n1nc j4p;c0lR|0AntiSpamSetting5 (antiSpamLevel:3) Running ...Python学习%N,K.ZC]`VW4`y

Python学习4|/z1n.k G1m9m[

Passed: AntiSpamSetting

wdvZJ1o0 Python学习 J ~5? YIZK

AntiSpamSetting6 (antiSpamLevel:-1) Running ...

EKy!`&V@8u2t-d0 Python学习mZ#Y"Q\%o

Passed: AntiSpamSettingPython学习GfE X4Xg^7XT]

顶:35 踩:51
对本文中的事件或人物打分:
当前平均分:-0.01 (268次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.21 (264次打分)
【已经有249人表态】
36票
感动
30票
路过
30票
高兴
28票
难过
31票
搞笑
26票
愤怒
34票
无聊
34票
同情
上一篇 下一篇