def test_multiple_http_mocks_independently_served(): """ Ask for two http mocks and set up different presets. Make calls against each. We should get the correct responses back. """ http_mock_1 = HTTPMock('localhost', 8000) http_mock_2 = HTTPMock('localhost', 8000) fake_client_1 = get_fake_client(http_mock_1) fake_client_2 = get_fake_client(http_mock_2) http_mock_1.reset() http_mock_2.reset() http_mock_1.when('GET /test_mock1_get').reply(b'You tested a get', 201, times=FOREVER) http_mock_2.when('GET /test_mock2_get').reply(b'You tested a get', 200, times=FOREVER) assert_equals(201, fake_client_1.get(url="/test_mock1_get").status) assert_equals(200, fake_client_2.get(url="/test_mock2_get").status) # Check that they both 404 if used against the other url. assert_equals(404, fake_client_1.get(url="/test_mock2_get").status) assert_equals(404, fake_client_2.get(url="/test_mock1_get").status)