title: Assign Mock Variable Value in Unit Test
body: <p>In Python I created a method that reads the contents of a web page and does some stuff with the contents.</p>
  
  <p>I want to unit test the method using a specific http address but I don't want to have to assign the address manually in my production code and then test it.  So ideally I want to create some kind of mock object (using the Mock library) that takes the value of the http address I need so I can run my test with that value.</p>
  
  <p>As a side note, the aim of the test is to verify that my code raises the correct exception with the tested http address.</p>
  
  <p>So to illustrate, the code I want to test has the following form:</p>
  
  <pre><code>Class A
  
      method1()
  
          var1 = "wwww.something.com"
          read contents at address var1
          do stuff with contents (raise error if bad contents)
  </code></pre>
  
  <p>And I want to test the code with var1 = "wwww.somethingelse.com" in my unit test (ideally using the Mock library).</p>
  
  <p>Appreciate any help.</p>