title: Pytest Flask, error 308 Permanent Redirect when login
body: <p>I want to try my app, here is the test code :</p>
  
  <pre><code>import sys
  import pytest
  from flask_simplelogin import SimpleLogin
  
  sys.path.insert(1, '')
  from app import app as myapp
  
  
  #---------------------------------------------------
  #SETUP
  #---------------------------------------------------
  
  myapp.config['SECRET_KEY'] = 'something-secret'
  myapp.config['SIMPLELOGIN_USERNAME'] = 'admin'
  myapp.config['SIMPLELOGIN_PASSWORD'] = 'secret'
  SimpleLogin(myapp)
  
  @pytest.fixture
  def app():
      return myapp
  
  @pytest.fixture
  def setup_url():
      return "http://127.0.0.1:8080/"
  
  def login(client):
      return client.post("http://127.0.0.1:8080/login", data=dict(
          username="admin",
          password="secret"
      ))
  
  #---------------------------------------------------
  #TESTS
  #---------------------------------------------------
  
  def test_get_list_campagne(client,setup_url):
      resp = login(client)
      assert resp.status_code==200
  
      resp = client.get("/Campagne")
      assert resp.status_code==200
  </code></pre>
  
  <p>But it returns a permanent redirection, so i tried with the attribute "follow_redirects=True" :</p>
  
  <pre><code>def login(client):
      return client.post("http://127.0.0.1:8080/login", data=dict(
          username="admin",
          password="taleinfo"
      ), follow_redirects=True)
  </code></pre>
  
  <p>But i think it is just a way to get around the problem, i don't think i'm logged after that.</p>
  
  <p>here the error :
  E       AssertionError: assert 308 == 200
  E        +  where 308 = &lt; 263 bytes [308 PERMANENT REDIRECT]>.status_code</p>
  
  <p>I do not found any similar problem.
  Thank you for your help.</p>