@@ -0,0 +1,918 @@
+import unittest%0Aimport requests%0Aimport subprocess%0Aclass ServerTest(unittest.TestCase):%0A  def testRequest():%0A    serverProc = subprocess.Popen(%5B'python', '../src/server.py'%5D, stdout=subprocess.PIPE, shell=True)%0A    test_data = %221234567890asdf%22%0A    resp = requests.get(%22http://localhost:5000?oauth_verifier=%25s%22 %25 testData)%0A    assert resp.status_code == 200%0A    try:%0A      resp = requests.get(%22http://localhost:5000?oauth_verifier=%25s%22 %25 testData)%0A    except requests.exceptions.ConnectionError as e:%0A      pass%0A    else:%0A      self.fail(%22Server responded to second request (It should only serve onece and die)%22)%0A    %0A    status = proc.poll()%0A    if status is None:  %0A      proc.kill()%0A      self.fail(%22Server process is still alive, killing now...%22)%0A    stdout, stderr = proc.communicate()%0A    %0A    assertFalse(stderr, %22stderr is nonempty%22)%0A    assertEqual(stdout, test_data, %22server didnt return fake oauth verifier!%22)%0A

Create ServerTest.py