title: simulating raw_input() in unittest module of python 2
body: <p>I'm trying to understand how to use unittest framework of python </p>
  
  <p>I have a piece of code that looks like this --</p>
  
  <pre><code>while True:
      filename = raw_input('Enter file')
      if os.path.exists(filename):
          break
      else:
          print "That file does not exist"
  return filename
  </code></pre>
  
  <p>Can somebody help me out in developing the unittest module to test this. I'm asking this question in order to learn how to use unittesting (i'm trying to learn TTD: Test-Driven Development)</p>
  
  <p>So far I've come up with this
  ...
  import unittest
  import os.path</p>
  
  <p>class TestFunctions(unittest.TestCase):</p>
  
  <pre><code>def setUp(self):
      self.prompt = 'Enter filename: '
  
  def test_get_file(self):
  
      # TODO make sure empty filename argument requests for new filename
      filename = find_author.get_valid_filename(self.prompt)
      self.assertTrue(&lt;EXPRESSION?&gt;)
  
      # TODO make sure valid filename returns the "filename"
      # TODO make sure invalid filename prompts that file does not exit and requests new filename 
  </code></pre>
  
  <p>if <strong>name</strong> == "<strong>main</strong>":
      unittest.main()</p>