I'm on Python 3.4. I'm trying to write tests using Selenium. I'm using https://flask-testing.readthedocs.org/en/latest/#testing-with-liveserver as a template. Here's the way I have my class set up:
class APITestCase(LiveServerTestCase):
def create_app(self):
app = create_app('testing')
return app
def setUp(self):
self.display = Display(visible=0, size=(1024, 768))
self.display.start()
self.driver = webdriver.Firefox()
def tearDown(self):
self.driver.close()
self.display.stop()
And for my only test:
def test_register(self):
register_link = self.get_server_url() + url_for('register')
self.driver.get(register_link)
I get a 404. Even using the requests library, I still get a 404.
I'm certain that /register is defined for the register
view function because I'm printing out the routes right before I call self.driver.get(register_link)
using the method here: get a list of all routes defined in the app
Furthermore, if I initialize a test client using self.client = app.test_client()
in the create_app
function, I'm able to access routes normally using self.client.get
or self.client.post
but that defeats the purpose of Selenium.