Exemplo n.º 1
0
    def get_some_things(self, faker_type: str = "" or list) -> str or int or float:
        """
        根据faker type生成响应数据,并返回结果
        :param faker_type: mobile, farm, name, shop, int, float
        :return:
        """
        data = ""
        fake = Factory().create('zh_CN')
        # 传入为list时,随机返回list中的一个值
        if isinstance(faker_type, list):
            return random.choice(faker_type)
        elif isinstance(faker_type, str):
            # 若传入时下列关键字,返回对应的值
            record = faker_type.lower()

            if record == 'mobile':
                data = fake.phone_number()
                self.L.info("随机生成手机号:%s" % data)

            elif record == 'farm':
                data = fake.company_prefix() + "的" + fake.name() + "在中国" + fake.city() + "的农场"
                self.L.info("随机生成农场名:%s" % data)

            elif record == 'name':
                data = fake.name()
                self.L.info("随机生成用户民:%s" % data)

            elif record == 'shop':
                data = fake.company()
                self.L.info("随机生成店铺名:%s" % data)

            elif record == 'integer':
                data = random.randint(1, 100)
                self.L.info("随机生成整数:%s" % data)

            elif record == 'decimal':
                data = random.uniform(1, 50)
                self.L.info("随机生成小数:%s" % data)
            elif record == 'text':
                data = (fake.text().replace("\n", " "))[:20]
                self.L.info("随机20位字符串:%s" % data)
            elif record == 'address':
                data = fake.address()
                self.L.info("随机生成地址:%s" % data)
        else:
            data = faker_type
        return data

# if __name__ == '__main__':
#         f = KeyFaker()
#         f.get_some_things('farm')
Exemplo n.º 2
0
from faker import Factory
from common.myCommon import Assertion
from common.myCommon.TestBaseCase import TestBaseCase
from common.myFile import MockData
from xqkj.query import sht_query
from xqkj.testAction import ShtAction
from xqkj.testAction import loginAction
from xqkj.testAction import Xqkj_web_finance_consumptionAction as PlatformAction
from xqkj.testAction import specialAction
import os
fake = Factory().create('zh_CN')
mobile = '131' + fake.ean8()
idcard = fake.ssn(min_age=18, max_age=100)
name = fake.name()
# 商户名称
merchantname = fake.company_prefix() + loginAction.sign


class test_005_sht_singing(TestBaseCase):
    def test_001_api_78dk_sht_merchant_signing(self):
        """
        立即签约,输入为空
        :return:
        """
        sht_query.update_wx_merchart_null()
        res = json.loads(ShtAction.test_api_78dk_sht_merchant_signing(signname='', merchantname='', signphone=''))
        Assertion.verity(res['code'], '20000')
        Assertion.verityFalse(res['isPage'])

    def test_002_api_78dk_sht_merchant_signing_256signname(self):
        """
Exemplo n.º 3
0
from common.myCommon import Assertion
from common.myCommon.TestBaseCase import TestBaseCase
from xqkj.query import xqkj_query
from xqkj.testAction import Xqkj_web_finance_consumptionAction as PlatformAction
from xqkj.testAction import loginAction

global_dict = loginAction.global_dict
fake = Factory().create('zh_CN')
# 商户名称
merchantname = loginAction.sign + fake.company()
name = fake.name_male() + loginAction.sign
email = loginAction.sign + fake.email()
mobile = '15388188697'
cardnumber = fake.credit_card_number(card_type=None)
store_name = loginAction.sign + fake.company_prefix()


class testXqkj_web_finance_consumption_002_Merchant(TestBaseCase):
    def test_001_api_78dk_platform_mm_base_saveMerchant(self):
        # 新增商户基本信息
        global channelid
        channelid = global_dict.get('channelid')
        res = json.loads(
            PlatformAction.test_api_78dk_platform_mm_base_saveMerchant(
                note='备注',
                name=merchantname,
                parentmerchantuuid='',
                shortname=merchantname + '商户简称',
                channeluuid=channelid))
        Assertion.verity(res['code'], '10000')