Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Feature: SR-2326 Сервис для генерации купонов
- Background:
- * url serverUrl
- * path "SET-Cards-Coupons/SET/UniqueCouponsWS"
- * def KarateDBHelper = Java.type('ru.crystals.testingtools.ws.karate.KarateDBHelper')
- * def JavaMethods = Java.type('ru.crystals.testingtools.ws.karate.KarateJavaMethods')
- * def TestContext = Java.type('ru.crystals.settester.TestContext')
- * def DbUtils = new KarateDBHelper(TestContext.CENTRUM)
- * string couponCategoryName = "Category-Generated-By-WS"
- Scenario: [SR-2317] Проверка генерации категории купонов
- * xmlstring reqXml = read('create_coupons_category.xml')
- Given request reqXml
- When method POST
- Then status 200
- * def couponCategoryId = /Envelope/Body/createCouponsCategoryResponse/guid
- * def couponCategory = DbUtils.readRow('SELECT * FROM CARD_CARDTYPE INNER JOIN CARD_COUPONS ON CARD_CARDTYPE.ID = CARD_COUPONS.ID WHERE CARD_CARDTYPE.GUID = '+ couponCategoryId)
- * match couponCategory contains { name: '#(couponCategoryName)', name_for_client: 'Random', description: 'Random'}
- #Доделать дату
- # * match couponCategory contains { activationdate: '2000-01-01 00:00:00.0', expirationdate: '2020-01-01 04:04:04.0'}
- Scenario: [SR-2318] Проверка создания экземпляра купона
- * def query = "SELECT id FROM card_cardtype WHERE name = '" + couponCategoryName + "' LIMIT 1"
- * def couponCategoryId = DbUtils.readValue(query)
- * def clientGuid = JavaMethods.createClientInDb(TestContext.CENTRUM)
- * xmlstring reqXml = read('create_unique_coupon.xml')
- Given request reqXml
- When method POST
- Then status 200
- * def couponNumber = /Envelope/Body/generateCouponsResponse/coupons/coupon/couponNumber
- * def couponEntityFromDB = DbUtils.readRow('SELECT * FROM CARD_UNIQUE_COUPON_EXEMPLAR LEFT JOIN CARD_CLIENTS ON CARD_UNIQUE_COUPON_EXEMPLAR.CLIENT_ID = CARD_CLIENTS.ID LEFT JOIN CARD_CARDTYPE ON CARD_UNIQUE_COUPON_EXEMPLAR.CARDTYPE_ID = CARD_CARDTYPE.ID WHERE CARD_UNIQUE_COUPON_EXEMPLAR.NUMBERFIELD = '+ couponNumber + ' ::text')
- * match couponEntityFromDB contains { cardtype_id: '#(couponCategoryId)', issuance_purchase_number: 1, issuance_shift_number: 2, issuance_shop_number: 3, numberfield: '#(couponNumber)'}
- Scenario: [SR-2326] - Получение информации по купону по его номеру из внешней системы
- * def query = "SELECT numberfield FROM card_unique_coupon_exemplar WHERE cardtype_id = (SELECT id FROM card_cardtype WHERE name = '" + couponCategoryName + "' LIMIT 1) LIMIT 1"
- * def couponNumberfield = DbUtils.readValue(query)
- * xmlstring reqXml = read('find_coupon_by_number.xml')
- Given request reqXml
- When method POST
- Then status 200
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/number == "#(couponNumberfield)"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/status == "Create"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/client/guid != null
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/purchaseNumber == "1"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/shiftNumber == "2"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/shopNumber == "3"
- Scenario: [SR-2327] - Получение информации о купонах по клиенту из внешней системы
- * def query = "SELECT card_clients.guid FROM card_clients LEFT JOIN card_unique_coupon_exemplar ON CARD_UNIQUE_COUPON_EXEMPLAR.CLIENT_ID = CARD_CLIENTS.ID LEFT JOIN CARD_CARDTYPE ON CARD_UNIQUE_COUPON_EXEMPLAR.CARDTYPE_ID = CARD_CARDTYPE.ID WHERE card_cardtype.name = '" + couponCategoryName + "' LIMIT 1"
- * def clientGuid = DbUtils.readValue(query)
- * def query = "SELECT numberfield FROM card_unique_coupon_exemplar WHERE cardtype_id = (SELECT id FROM card_cardtype WHERE name = '" + couponCategoryName + "' LIMIT 1) LIMIT 1"
- * def couponNumberfield = DbUtils.readValue(query)
- * xmlstring reqXml = read('find_coupon_by_client.xml')
- Given request reqXml
- When method POST
- Then status 200
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/number == "#(couponNumberfield)"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/status == "Create"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/client/guid != null
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/purchaseNumber == "1"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/shiftNumber == "2"
- And match response /Envelope/Body/findCouponExemplarsResponse/exemplars/distributionReceipt/shopNumber == "3"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement