mirror of https://github.com/logos-co/open-law.git
fix tests
This commit is contained in:
parent
9fabd47650
commit
f03a0ece33
|
@ -24,23 +24,8 @@
|
|||
{{form.password.label(class='block mb-2 text-sm font-medium text-gray-900 dark:text-white')}}
|
||||
{{form.password(class='bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500')}}
|
||||
</div>
|
||||
|
||||
<div class="flex items-start">
|
||||
<div class="flex items-center h-5">
|
||||
<!-- prettier-ignore -->
|
||||
<input id="remember" aria-describedby="remember" name="remember" type="checkbox" class="w-4 h-4 border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:bg-gray-700 dark:border-gray-600" required/>
|
||||
</div>
|
||||
<div class="ml-3 text-sm">
|
||||
<!-- prettier-ignore -->
|
||||
<label for="remember" class="font-medium text-gray-500 dark:text-gray-400">Remember this device</label>
|
||||
</div>
|
||||
<!-- prettier-ignore -->
|
||||
<a href="{{ url_for('auth.forgot_pass') }}" class="ml-auto text-sm font-medium text-blue-600 hover:underline dark:text-blue-500">Lost Password?</>
|
||||
</div>
|
||||
<!-- prettier-ignore -->
|
||||
<button type="submit" class="w-full px-5 py-3 text-base font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 sm:w-auto dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Login to your account</button>
|
||||
<!-- prettier-ignore -->
|
||||
<div class="text-sm font-medium text-gray-900 dark:text-white">Not registered yet?<a class="text-blue-600 hover:underline dark:text-blue-500" href="{{ url_for('auth.register') }}" >Create account</a></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@ from flask.testing import FlaskClient
|
|||
|
||||
from app import create_app, db
|
||||
from app import models as m
|
||||
from tests.utils import register
|
||||
from tests.utils import create
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
@ -27,7 +27,7 @@ def client(app: Flask):
|
|||
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
register()
|
||||
create()
|
||||
|
||||
yield client
|
||||
db.session.remove()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from tests.utils import login
|
||||
from tests.utils import login, create
|
||||
|
||||
TEST_EMAIL = "test@gmail.com"
|
||||
|
||||
|
@ -12,11 +12,11 @@ def test_auth_pages(client):
|
|||
|
||||
def test_login_and_logout(client):
|
||||
# Access to logout view before login should fail.
|
||||
response = login(client, "sam")
|
||||
response = login(client)
|
||||
assert b"Login successful." in response.data
|
||||
# Incorrect login credentials should fail.
|
||||
response = login(client, "sam", "wrongpassword")
|
||||
assert b"Wrong user ID or password." in response.data
|
||||
# Correct credentials should login
|
||||
response = login(client, "sam")
|
||||
response = login(client)
|
||||
assert b"Login successful." in response.data
|
||||
|
|
|
@ -5,7 +5,7 @@ TEST_ADMIN_EMAIL = "bob@test.com"
|
|||
TEST_ADMIN_PASSWORD = "password"
|
||||
|
||||
|
||||
def register(
|
||||
def create(
|
||||
username=TEST_ADMIN_NAME, email=TEST_ADMIN_EMAIL, password=TEST_ADMIN_PASSWORD
|
||||
):
|
||||
user = User(username=username, email=email)
|
||||
|
|
Loading…
Reference in New Issue