File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 4
4
from flask .testing import FlaskClient
5
5
import pytest
6
6
7
+ from lms .lmsweb import config_file
7
8
from lms .lmsweb .config import CONFIRMATION_TIME , MAIL_DEFAULT_SENDER
8
9
from lms .lmsdb .models import User
9
10
from lms .models .users import generate_user_token
@@ -133,6 +134,10 @@ def test_expired_token(client: FlaskClient):
133
134
assert success_login_response .status_code == 200
134
135
135
136
@staticmethod
137
+ @pytest .mark .skipif (
138
+ condition = not config_file .is_file (),
139
+ reason = 'should run with configuration file and correct mail info' ,
140
+ )
136
141
def test_successful_registration (client : FlaskClient , captured_templates ):
137
142
conftest .enable_mail_sending ()
138
143
client .post ('/signup' , data = {
Original file line number Diff line number Diff line change @@ -112,14 +112,18 @@ def test_valid_change_password(captured_templates):
112
112
assert check_logout_response .status_code == 302
113
113
114
114
@staticmethod
115
- def test_forgot_my_password (client : FlaskClient , captured_templates ):
116
- user = conftest .create_student_user (index = 1 )
115
+ def test_forgot_my_password_invalid_mail (
116
+ client : FlaskClient , captured_templates ,
117
+ ):
117
118
client .post ('/reset-password' , data = {
118
119
'email' : 'fake-mail@mail.com' ,
119
120
}, follow_redirects = True )
120
121
template , _ = captured_templates [- 1 ]
121
122
assert template .name == "resetpassword.html"
122
123
124
+ @staticmethod
125
+ def test_forgot_my_password (client : FlaskClient , captured_templates ):
126
+ user = conftest .create_student_user (index = 1 )
123
127
client .post ('/reset-password' , data = {
124
128
'email' : user .mail_address ,
125
129
}, follow_redirects = True )
You can’t perform that action at this time.
0 commit comments