0

Mock the sftp-list operation especially the attributes with file name and its path. These attributes are used in a for each loop are not available.

1
  • You should add a minimal reproducible example to the question so people can understand the operation that you want to mock. Commented Mar 11 at 11:58

1 Answer 1

1

Correct way to mock sftp-list operation where attributes can be available inside foreach loop:

<flow doc:name="Flow" >
    <file:list doc:name="List" config-ref="File_Config" directoryPath="/tmp/"/>
</flow>

<munit-tools:mock-when processor="file:list">
    <munit-tools:with-attributes>
       <munit-tools:with-attribute attributeName="doc:name" whereValue="List"/>
    </munit-tools:with-attributes>
    <munit-tools:then-return>
       <munit-tools:payload value="#[[MunitTools::createMessage( &quot;ITEM-1&quot;,  &quot;text/plain&quot;, { name : 'file1.txt'}, null) , MunitTools::createMessage( &quot;ITEM-2&quot;,  &quot;text/plain&quot;, { name : 'file2.txt'}, null)]]" />
</munit-tools:then-return>
</munit-tools:mock-when>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.