Passing a JSON to Scenario Outline - karate

https://github.com/intuit/karate/issues/554
I have a multirow JSON, I would like to iterate for each row using Scenario outline
It is working if I call by the row number, i am using a dynamic JSON file
Data.json
[
{
"address": {
"addressLine1": "ttes",
"addressLine2": "Test"
},
"name": {
"firstName": "TEST",
"lastName": "TEST"
},
"phone": {
"phoneExtension": "1234",
"phoneNumber": "999999999"
},
"email": {
"emailAddress": "TEST#TEST.com"
}
},
{
"address": {
"addressLine1": "ttes1",
"addressLine2": "Test1"
},
"name": {
"firstName": "TEST1",
"lastName": "TEST1"
},
"phone": {
"phoneExtension": "1234",
"phoneNumber": "999999999"
},
"email": {
"emailAddress": "TEST#TEST1.com"
}
}]
Working if
Feature: Read from File
Background:
* def Testdata = read('Data.json')
Scenario Outline: [1] Test with multiple records on JSON
Given url_stg
And path 'test','test'
And request Testdata[0]
When method POST
Examples:
|Testdata |
Working for Testdata[0]. I have dynamic json, I am looking for a way to iterate through the json autoamtically.
My request body should be one row from JSON like :
{
"address": {
"addressLine1": "ttes1",
"addressLine2": "Test1",
},
"name": {
"firstName": "TEST1",
"lastName": "TEST1",
},
"phone": {
"phoneExtension": "1234",
"phoneNumber": "999999999",
},
"email": {
"emailAddress": "TEST#TEST1.com"
}

This will be easier in the next version, see this ticket: https://github.com/intuit/karate/issues/717#issuecomment-489339287
So if you can build from source and test that would help.
For now you have to do this:
And request { address: <address>, name: <name>, phone: <phone>, email: <email> }

Related

Shopware 6 API / Product Listing / How to add available color variants for each product on the response

API Request
/store-api/product-listing/{categoryId}
I want each product in the API response to have available color variants. Because I want to show color variants on the product list page. But currently this data is not provided by the shopware 6 api.
I've tried to add this data by using associations but it didnt help.
Request Body
{
"includes": {
"product": ["id", "productNumber", "cover", "options"]
},
"associations": {
"options": {
"media": []
}
}
}
The request body looks to be correct. If the product is a variant then it should have content for options.
To verify try the following request body:
{
"limit": 1,
"includes": {
"product": ["id", "productNumber", "options"],
"property_group_option": ["name", "group"],
"property_group": ["name"]
},
"associations": {
"options": {
"associations": {
"group": []
}
}
},
"filters": [
{
"type": "not",
"operator": "and",
"queries": [
{
"type": "equals",
"field": "parentId",
"value": null
}
]
}
]
}
This should yield a single variant.
Response should look similar to this:
{
"entity": "product",
"total": 1,
"aggregations": [],
"page": 1,
"limit": 1,
"elements": [
{
"productNumber": "10042.1",
"options": [
{
"name": "linen",
"group": {
"name": "textile",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
},
{
"name": "35",
"group": {
"name": "size",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
},
{
"name": "chartreuse",
"group": {
"name": "shirt-color",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
}
],
"id": "0002ea44c49c41ecb91c43e7e49e422d",
"apiAlias": "product"
}
],
"states": [],
"apiAlias": "dal_entity_search_result"
}

Scenario Outline in Karate for multi-line JSON

How to use scenario outline to iterate for a JSON which is more than single cell
https://github.com/intuit/karate#the-cucumber-way
Data.json
[{
"address": {
"addressLine1": "ttes",
"addressLine2": "Test",
"addressLine3": "Test",
"addressType": "business",
"city": "TEST",
"company": "TEST",
"country": "TEST",
"state": "TEST",
"postalCode": "XXXX"
},
"name": {
"firstName": "TEST",
"lastName": "TEST",
"middleInit": "T",
"title": "Mr."
},
"phone": {
"phoneExtension": "1234",
"phoneNumber": "999999999",
"phoneType": "mobile"
},
"email": {
"emailAddress": "TEST#TEST.com"
}
},
{
"address": {
"addressLine1": "ttes1",
"addressLine2": "Test1",
"addressLine3": "Test1",
"addressType": "business",
"city": "TEST1",
"company": "TEST1",
"country": "TEST1",
"state": "TEST1",
"postalCode": "XXXX"
},
"name": {
"firstName": "TEST1",
"lastName": "TEST1",
"middleInit": "T",
"title": "Mr."
},
"phone": {
"phoneExtension": "1234",
"phoneNumber": "999999999",
"phoneType": "mobile"
},
"email": {
"emailAddress": "TEST#TEST1.com"
}
}]
====
Feature: Read from File
Background:
* def Testdata = read('Data.json')
Scenario Outline: [1] Test with multiple records on JSON
Given url_stg
And path 'test','test'
And request Testdata
When method POST
Examples:
|Testdata |
Please refer it in this documentation as it very straight forward for your case.
dynamic-scenario-outline
refer to this answer for different ways of providing data to Scenario Outline:
https://stackoverflow.com/a/56135752/8615449

Get list of users with the "send on behalf of" permission

Using the V2 DocuSign REST API, is it possible to get a list of users who have the "send on behalf of" and "account wide" permission?
Looking through the docs, I see that the Get User List method does not return any permission info. The Get User Information method returns a little more but nothing permission specific, other than a permissionProfileId for each group.
So is it possible to get permission info with user data? Or is there a method I can call using the permissionProfileId to check if a user has those permissions?
What I am ultimately trying to do is get a list of users who are able to use the "Send on behalf of" feature which requires the "send on behalf of" and "account-wide rights" permissions.
You can get a list of all users and their User Settings with below rest method as an DS Admin:
https://demo.docusign.net/restapi/v2/accounts/[accountid]/users/?additional_info=true
Sample output below:
{
"users": [
{
"userName": "DocuSignTest2 User-2",
"userId": "b67aa83b-2b3e-4669-a897-89e44b5724c2",
"userType": "CompanyUser",
"isAdmin": "False",
"userStatus": "Created",
"uri": "/users/b67aa83b-2b3e-4669-a897-89e44b5724c2",
"email": "youremail#yourdoman.com",
"firstName": "DocuSignTest2",
"lastName": "User-2",
"userSettings": [
{
"name": "canManageAccount",
"value": "false"
},
{
"name": "canSendEnvelope",
"value": "true"
},
{
"name": "locale",
"value": "en"
},
{
"name": "canSendAPIRequests",
"value": "false"
},
{
"name": "apiAccountWideAccess",
"value": "false"
},
{
"name": "enableVaulting",
"value": "false"
},
{
"name": "vaultingMode",
"value": "none"
},
{
"name": "enableTransactionPoint",
"value": "true"
},
{
"name": "enableSequentialSigningAPI",
"value": "true"
},
{
"name": "enableSquentialSigningUI",
"value": "true"
},
{
"name": "enableDSPro",
"value": "false"
},
{
"name": "powerFormAdmin",
"value": "false"
},
{
"name": "powerFormUser",
"value": "true"
},
{
"name": "canEditSharedAddressbook",
"value": "use_private_and_shared"
},
{
"name": "canManageTemplates",
"value": "create"
},
{
"name": "enableSignOnPaperOverride",
"value": "false"
},
{
"name": "enableSignerAttachments",
"value": "true"
},
{
"name": "allowSendOnBehalfOf",
"value": "false"
},
{
"name": "allowRecipientLanguageSelection",
"value": "true"
},
{
"name": "selfSignedRecipientEmailDocument",
"value": "include_pdf"
}
],
"sendActivationOnInvalidLogin": "false",
"enableConnectForUser": "false",
"groupList": [
{
"groupId": "128693",
"groupName": "Everyone",
"groupType": "everyoneGroup"
}
],
"workAddress": {
"address1": "",
"address2": "",
"city": "",
"stateOrProvince": "",
"postalCode": "",
"phone": "",
"country": ""
},
"homeAddress": {
"address1": "",
"address2": "",
"city": "",
"stateOrProvince": "",
"postalCode": "",
"phone": "",
"country": ""
}
},
[rest removed for sake of example]
There is not one call that can complete this task.
My recommendation is to put all of these users in a Group and then you can query who is in the group through the API.
Example get list of user's per group:
GET https://{server}.docusign.net/restapi/v2/accounts/{accountId}/groups/{groupId}/users
If you want to audit the group or see who you need to move into the group you can get a list of users and then look at user details per user (loop through programmaticaly).
Example get user settings to check userSettings->allowSendOnBehalfOf :
GET https://{server}.docusign.net/restapi/v2/accounts/{accountId}/users/{userId}

pentaho Error 64k limit in JSON FileInput

I created a job which extracts json datas from a webservice. It works on my PC but not when I export it on my dev. server (Ubuntu Server x64). please help me on this.
ERROR
"Caused by: sun.org.mozilla.javascript.EvaluatorException: Encountered
code generation error while compiling script: generated bytecode for
method exceeds 64K limit. (#1)"
JSON format
"[{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": xxxxx
},
"phoneNumber": [
{
"type": "home",
"number": "xxx xxx-xxxx"
},
{
"type": "fax",
"number": "xxx xxx-xxxx"
}
]
},
{
"firstName": "John",
"lastName": "david",
"age": 28,
"address": {
"streetAddress": "23 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": xxxxx
},
"phoneNumber": [
{
"type": "home",
"number": "xxx xxx-xxxx"
},
{
"type": "fax",
"number": "xxx xxx-xxxx"
}
]
},
{
"firstName": "Jondy",
"lastName": "rodes",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "Kenucky",
"state": "KY",
"postalCode": xxxxx
},
"phoneNumber": [
{
"type": "home",
"number": "xxx xxx-xxxx"
},
{
"type": "fax",
"number": "xxx xxx-xxxx"
}
]
}]"
See this forum post here:
http://forums.pentaho.com/showthread.php?89304-Job-runs-fine-in-Spoon-but-not-in-Kettle-Exceeds-64K-in-Json-Input-step
The suggestion seems to be to use the javascript step then turn off the optimisation option.
64k limit problem with jvm lower versions. Upgrade your java to 1.7 version. Problem will be solve.

Extracting values from a JSON string

I want to retrieve the different tag values in an NSString.
NSString *test =
{
"data": [
{
"id": "100002319144563_125257217561582",
"from": {
"name": "Umair Ahmed",
"id": "100002319144563"
},
"message": "Hello Umair Here",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/100002319144563/posts/125257217561582"
},
{
"name": "Like",
"link": "http://www.facebook.com/100002319144563/posts/125257217561582"
}
],
"privacy": {
"description": "Everyone",
"value": "EVERYONE"
},
"type": "status",
"application": {
"name": "iPhone",
"id": "213257025359930"
},
"created_time": "2011-07-08T11:59:15+0000",
"updated_time": "2011-07-08T11:59:15+0000"
},
{
"id": "100002319144563_125251050895532",
"from": {
"name": "Umair Ahmed",
"id": "100002319144563"
},
"message": "Hello testing testing",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/100002319144563/posts/125251050895532"
},
{
"name": "Like",
"link": "http://www.facebook.com/100002319144563/posts/125251050895532"
}
]
}
]
}
How can I retrieve the name and message tag values into an array or dictionary?
It looks like a JSON string, so just use one of JSON libraries, like TouchJSON or JSONKit and you can easily extract the data from the structures they will provide you.