from models.soap import SoapMethods

obj = SoapMethods()
#test_set = obj.openConfig()["testSet"]["getCards"] # набор данных для теста с test_data.json
param = obj.openConfig()["testSet"]["card"]
wsdl = obj.openConfig()["wsdl"][param]


def test_getBalanceByAllParams():
    res = obj.connectToWebService(wsdl).service.getActualBalanceByCard(
        contractId=2440669, accountNumber='2625')
    print(type(res))
    print(res)


def test_getBalanceByContractId():
    res = obj.connectToWebService(wsdl).service.getActualBalanceByCard(
        contractId=2440669)
    print(type(res))
    print(res)
示例#2
0
from models.soap import SoapMethods

class SQLActivateDeal:

    def getDealForActivate(self):
        s = 'SELECT ar.extclientid, ag.legalcontractnum, ag.charactseller, ag.statusagrid ' \
            'FROM alf_registercontractlog ar ' \
            'JOIN privateclients pc on pc.extclientprivid = ar.extclientid ' \
            'JOIN agreements ag on ag.clientprivid = pc.clientprivid ' \
            'WHERE ar.activate = 0 ' \
            'AND ar.errorcode = 0 AND ag.statusagrid = 1 and ag.charactseller is not null ' \
            'AND ag.legalcontractnum = ag.charactseller ' \
            'AND ROWNUM = 1'
        return s

    def checkDealForActivateStatus(self, charactseller):
        bind = {"charactseller": str(charactseller)}
        s = 'select ag.statusagrid ' \
            'from IC.Agreements ag ' \
            'where ag.legalcontractnum = :bind'  #+ str(cardNumber)
        cur = {"s": s, "bind": bind}
        return cur

if __name__ == '__main__':
    obj = SoapMethods()
    #print(obj.openXlsFile('D:\Python\SOAP\delivery12.xlsx'))
    print(obj.dbConnect(db='ISCARDT2_AIX').execute(SQLActivateDeal().getDealForActivate()).fetchall())
    t = SQLActivateDeal().checkDealForActivateStatus(630007040)
    cur = obj.dbConnect(db='ISCARDT2_AIX').execute(t["s"], bind=str(t["bind"]["charactseller"])).fetchall()
    print(cur)
示例#3
0

class SQLActivateCard:
    def getCardForActivate(self):
        s = 'select c.cardnum as cardNumber, pr.cidentcode as taxid, pr.pnumber as passportNumber, pr.mobilephone as phoneNumber ' \
            'from IC.Cards c ' \
            'join IC.Agreements ag on ag.contractid = c.contractid ' \
            'join IC.Privateclients pr on ag.clientprivid = pr.clientprivid ' \
            'where c.cardstatusid = 1 and rownum = 1'
        return s

    def checkCardForActivateStatus(self, cardNumber):
        bind = {"cardNumber": str(cardNumber)}
        s = 'select c.cardstatusid ' \
            'from IC.Cards c ' \
            'where c.cardnum = :bind'  #+ str(cardNumber)
        cur = {"s": s, "bind": bind}
        return cur


if __name__ == '__main__':
    obj = SoapMethods()
    #print(obj.openXlsFile('D:\Python\SOAP\delivery12.xlsx'))
    print(
        obj.dbConnect(db='ISCARDT2_AIX').execute(
            SQLActivateCard().getCardForActivate()).fetchall())
    t = SQLActivateCard().checkCardForActivateStatus(4226051550023777)
    cur = obj.dbConnect(db='ISCARDT2_AIX').execute(
        t["s"], bind=str(t["bind"]["cardNumber"])).fetchall()
    print(cur)
示例#4
0
def obj():
    return SoapMethods()
示例#5
0
from models.soap import SoapMethods
from datetime import datetime
from zeep.xsd.elements.indicators import max_occurs_iter
from zeep import xsd
obj = SoapMethods()
#test_set = obj.openConfig()["testSet"]["getCards"] # набор данных для теста с test_data.json
#param = obj.openTestData()[test_set]
wsdl = obj.openConfig()["wsdl"]["createApplication"]


def test_createMassApps(obj):
    f = obj.openXlsFile('D:\Python\SOAP\delivery_2.xlsx')
    v_count = 0
    for t in f:
        if len(str(f[str(t)][0])) > 1:
            contragentId = str(f[str(t)][0]).split(".")[0].strip()
            shopId = str(f[str(t)][7]).split(".")[0].strip()
            cardId = int(str(f[str(t)][9]).split(".")[0])
            objectTypeId = int(str(f[str(t)][12]).split(".")[0])
            dateExp = datetime.fromordinal(datetime(1900, 1, 1).toordinal() + int(f[str(t)][16]) - 2).date()
            plannedDeliveryDate=datetime.fromordinal(datetime(1900, 1, 1).toordinal() + int(f[str(t)][19]) - 2).date()
            #listOfNecessaryDocuments = {"documentType": 1, "documentName": 'test', "documentDescription": 'test1'}
            #listOfNecessaryDocuments = (1, 'test', 'test1')
            xsd_type = xsd.ComplexType(
                xsd.Sequence([
                    xsd.Element('documentType', xsd.String()),
                    xsd.Element('documentName', xsd.String()),
                    xsd.Element('documentDescription', xsd.String())
                ]))
            listOfNecessaryDocuments = xsd_type(1, 2, 3)
示例#6
0
from models.soap import SoapMethods
#test_set = SoapMethods().openConfig()["testSet"]["getApp"] # набор данных для теста с test_data.json
#param = SoapMethods().openTestData()[test_set]
wsdl = SoapMethods().openConfig()["wsdl"]["getApp"]


def test_mandatory_params(obj):
    res = obj.connectToWebService(wsdl).service.createApplication()
示例#7
0
from models.soap import SoapMethods
from sql.sql_activateCardDeal import SQLActivateDeal

obj = SoapMethods()
sql = SQLActivateDeal()
#test_set = obj.openConfig()["testSet"]["getCards"] # набор данных для теста с test_data.json
param = obj.openConfig()["testSet"]["card"]
wsdl = obj.openConfig()["wsdl"][param]
connect = obj.dbConnect("ISCARDT2_AIX")


def test_activateCardDeal():
    #res = obj.connectToWebService(wsdl).service.activateCardDeal(contragentId='2942575', dealNo='650121251')

    sql_res = connect.execute(sql.getDealForActivate()).fetchall()
    res = obj.connectToWebService(wsdl).service.activateCardDeal(
        contragentId=sql_res[0][0], dealNo=sql_res[0][1])
    t = sql.checkDealForActivateStatus(sql_res[0][1])
    r = connect.execute(t["s"],
                        bind=str(t["bind"]["charactseller"])).fetchall()[0]
    assert str(r[0]) == '0'
    obj.closeDBConnect(connect)

    print(res)
    #assert len(res) == 0
示例#8
0
from models.soap import SoapMethods
test_set = SoapMethods().openConfig()["testSet"]["getCards"] # набор данных для теста с test_data.json
param = SoapMethods().openTestData()[test_set]
wsdl = SoapMethods().openConfig()["wsdl"]["getCards"]

def test_shopId(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"])
        assert res["countMessages"]

def test_cardHash(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], cardHash=param["cardHash"])
        assert res["countMessages"]

def test_cardId(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], cardId=int(param["cardId"]))
        assert res["countMessages"]

def test_cardDeliveryStatus(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], cardDeliveryStatus=param["cardDeliveryStatus"])
        assert res["countMessages"]

def test_embCardName(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], embCardName=param["embCardName"])
        assert res["countMessages"]

def test_cardPrefix(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], cardPrefix=param["cardPrefix"])
        assert res["countMessages"]

def test_cardSuffix(obj):
        res = obj.connectToWebService(wsdl).service.getCards(shopId=param["shopId"], cardSuffix=param["cardSuffix"])