<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi,<br>
    <br>
    I didn't find the answer yet, but I tested another approach with
    httmock package.<br>
    <br>
    <br>
    <a
href="https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/test/test_pdns_zone.py#L73">https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/test/test_pdns_zone.py#L73</a><br>
    <br>
    I also gonna explore setting up an instance of powerdns to have a
    fully testable environment.<br>
    <br>
    I you still have mocking / testing suggestion I'm interested.<br>
    <br>
    Regards,<br>
    Sylvain.<br>
    <br>
    Nothing under this citation, new version has been commited, links
    may be wrong.<br>
    <blockquote
      cite="mid:bc34d5b9-4f9d-3b2f-e245-c3226c74a42d@opensource-expert.com"
      type="cite">
      <p> I'm having trouble to understand how to use correctly mock
        object to test correctness of requests' call and also returned
        object. </p>
      <p> I'm using <tt>py.test</tt> + <tt>pytest-mock</tt> </p>
      <p> I would like to test here that <tt>r.text</tt> is returned if
        I call:<br>
      </p>
      <div style="padding-left: 30pt"> <tt>r = p.exec_pdns_api('GET',
          rest_url, text=True)</tt> </div>
      <a moz-do-not-send="true"
href="https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/pdns_zone.py#L79"
title="https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/pdns_zone.py#L79"
        class="https">https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/pdns_zone.py#L79</a>
      <p> how to I make an assertion that the <tt>r.text</tt> has been
        called/returned? </p>
      <p> r is <tt>&lt;MagicMock name='get().text'
          id='139703066450704'&gt;</tt> </p>
      <p> <tt>r.text.assert_called() </tt>is not the good assertion<br>
        test code here: <a moz-do-not-send="true"
href="https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/test/test_pdns_zone.py#L40">https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/test/test_pdns_zone.py#L40</a><br>
      </p>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Sylvain Viart - DevOps système linux - freelance developer</pre>
  </body>
</html>