How to use retcode method in yandex-tank

Best Python code snippet using yandex-tank

WebServiceTests.py

Source:WebServiceTests.py Github

copy

Full Screen

1#######################################################################2# SingularMS version 1.0 #3#######################################################################4# This file is a part of SingularMS. #5# #6# SingularMs is free software; you can copy, modify, and distribute #7# it under the terms of the GNU Affero General Public License #8# Version 1.0, 21 May 2007. #9# #10# SingularMS is distributed in the hope that it will be useful, but #11# WITHOUT ANY WARRANTY; without even the implied warranty of #12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #13# See the GNU Affero General Public License for more details. #14# #15# You should have received a copy of the GNU Affero General Public #16# License with this program; if not, contact Galotecnia #17# at contacto[AT]galotecnia[DOT]org. If you have questions about the #18# GNU Affero General Public License see "Frequently Asked Questions" #19# at http://www.gnu.org/licenses/gpl-faq.html #20#######################################################################21import datetime22from django.test import TestCase23from webservice import SMSProcessor24from accounting.models import Customer25from accounting.models import Purchase26class WebServiceTests (TestCase):27 fixtures = ['customer_tests.json', ]28 username = 'pepito'29 password = 'password'30 wrong_username = 'noUser'31 wrong_password = 'bad_password'32 def setUp(self):33 pass34 def test_getAccounts_wrong_password (self):35 processor = SMSProcessor ()36 retcode = processor.getAccounts (WebServiceTests.wrong_username, WebServiceTests.wrong_password)37 self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)38 def test_getAccounts_ok_with_accounts (self):39 processor = SMSProcessor ()40 retcode = processor.getAccounts (WebServiceTests.username, WebServiceTests.password)41 self.assertEqual (len(retcode), 3)42 self.assertEqual (retcode[0], 'AccessNoPurchase')43 self.assertEqual (retcode[1], 'AccessWithPurchase')44 self.assertEqual (retcode[2], 'AccessServeralPurchases')45 def test_getAccounts_ok_without_accounts (self):46 processor = SMSProcessor ()47 retcode = processor.getAccounts ('customer1', 'password')48 self.assertEqual (retcode, [])49 def test_getChannels_ok_without_channels (self):50 processor = SMSProcessor ()51 retcode = processor.getChannels ('customer1', 'password')52 self.assertEqual (retcode, [])53 def test_getChannels_ok_with_channels (self):54 processor = SMSProcessor ()55 retcode = processor.getChannels (WebServiceTests.username, WebServiceTests.password)56 self.assertEqual (retcode, [u'TestChannel'])57 def test_getCredit_wrong_password (self):58 processor = SMSProcessor ()59 retcode = processor.getCredit (WebServiceTests.wrong_username, WebServiceTests.wrong_password, 'AccessNoPurchase')60 self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)61 def test_getCredit_no_credit(self):62 processor = SMSProcessor ()63 retcode = processor.getCredit (WebServiceTests.username, WebServiceTests.password, 'AccessNoPurchase')64 self.assertEqual (retcode, 0)65 def test_getCredit_credit(self):66 processor = SMSProcessor ()67 retcode = processor.getCredit (WebServiceTests.username, WebServiceTests.password, 'AccessServeralPurchases')68 self.assertEqual (retcode, 1907)69 def test_getStatus_wrong_password (self):70 processor = SMSProcessor ()71 retcode = processor.getStatus (WebServiceTests.wrong_username, WebServiceTests.wrong_password, 'whatever')72 self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)73 def test_getStatus_wrong_id (self):74 processor = SMSProcessor ()75 retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'whatever')76 self.assertEqual (retcode[0], (True, 'badid'))77 def test_getStatus_wriht_id (self):78 processor = SMSProcessor ()79 retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'testMessage1')80 self.assertEqual (retcode[0], (False, u''))81 def test_getStatus_wriht_id_not_owner (self):82 processor = SMSProcessor ()83 retcode = processor.getStatus ('customer1', 'password', 'testMessage1')84 self.assertEqual (retcode[0], (True, 'badid'))85 def test_sendSMS_wrong_password (self):86 processor = SMSProcessor ()87 retcode = processor.sendSMS (WebServiceTests.wrong_username, WebServiceTests.wrong_password,88 'whatever', 'foo', 'bar', datetime.datetime.now())89 self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)90 def test_sendSMS_wrong_account (self):91 processor = SMSProcessor ()92 retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,93 'wrongAccount', 'foo', 'bar', datetime.datetime.now())94 self.assertEqual (retcode, Customer.WRONG_ACCOUNT)95 def test_sendSMS_no_credit (self):96 processor = SMSProcessor ()97 retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,98 'AccessNoPurchase', 'foo', 'bar', datetime.datetime.now())99 self.assertEqual (retcode, Purchase.INSUFFICIENT_CREDIT)100 def test_sendSMS (self):101 processor = SMSProcessor ()102 retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,103 'AccessWithPurchase', 'foo', 'bar', datetime.datetime.now())...

Full Screen

Full Screen

response_code.py

Source:response_code.py Github

copy

Full Screen

1# coding:utf-82class RETCODE:3 OK = "0"4 IMAGECODEERR = "4001"5 THROTTLINGERR = "4002"6 NECESSARYPARAMERR = "4003"7 USERERR = "4004"8 PWDERR = "4005"9 CPWDERR = "4006"10 MOBILEERR = "4007"11 SMSCODERR = "4008"12 ALLOWERR = "4009"13 SESSIONERR = "4101"14 DBERR = "5000"15 EMAILERR = "5001"16 TELERR = "5002"17 NODATAERR = "5003"18 NEWPWDERR = "5004"19 OPENIDERR = "5005"20 PARAMERR = "5006"21 STOCKERR = "5007"22err_msg = {23 RETCODE.OK: u"成功",24 RETCODE.IMAGECODEERR: u"图形验证码错误",25 RETCODE.THROTTLINGERR: u"访问过于频繁",26 RETCODE.NECESSARYPARAMERR: u"缺少必传参数",27 RETCODE.USERERR: u"用户名错误",28 RETCODE.PWDERR: u"密码错误",29 RETCODE.CPWDERR: u"密码不一致",30 RETCODE.MOBILEERR: u"手机号错误",31 RETCODE.SMSCODERR: u"短信验证码有误",32 RETCODE.ALLOWERR: u"未勾选协议",33 RETCODE.SESSIONERR: u"用户未登录",34 RETCODE.DBERR: u"数据错误",35 RETCODE.EMAILERR: u"邮箱错误",36 RETCODE.TELERR: u"固定电话错误",37 RETCODE.NODATAERR: u"无数据",38 RETCODE.NEWPWDERR: u"新密码数据",39 RETCODE.OPENIDERR: u"无效的openid",40 RETCODE.PARAMERR: u"参数错误",41 RETCODE.STOCKERR: u"库存不足",...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful