def test_success_continue(self, root): from kotti.views.login import set_password self.form_values({ "token": "mytoken", "email": "myemail", "password": "******", "continue_to": "http://example.com/here#there", }) self.user.confirm_token = "mytoken" context, request = root, DummyRequest(post={"submit": "submit"}) res = set_password(context, request) assert res.status == "302 Found" assert res.location == "http://example.com/here#there"
def test_success_continue(self, root): from kotti.views.login import set_password self.form_values({ 'token': 'mytoken', 'email': 'myemail', 'password': '******', 'continue_to': 'http://example.com/here#there', }) self.user.confirm_token = 'mytoken' context, request = root, DummyRequest(post={'submit': 'submit'}) res = set_password(context, request) assert res.status == '302 Found' assert res.location == 'http://example.com/here#there'
def test_success_continue(self, root): from kotti.views.login import set_password self.form_values({ 'token': 'mytoken', 'email': 'myemail', 'password': '******', 'continue_to': 'http://example.com/here#there', }) self.user.confirm_token = 'mytoken' context, request = root, DummyRequest( post={'submit': 'submit'}) res = set_password(context, request) assert res.status == '302 Found' assert res.location == 'http://example.com/here#there'
def test_success_continue(self, root): from kotti.views.login import set_password self.form_values( { "token": "mytoken", "email": "myemail", "password": "******", "continue_to": "http://example.com/here#there", } ) self.user.confirm_token = "mytoken" context, request = root, DummyRequest(post={"submit": "submit"}) res = set_password(context, request) assert res.status == "302 Found" assert res.location == "http://example.com/here#there"
def test_wrong_token(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ 'token': 'wrongtoken', 'email': 'myemail', 'password': '******', 'continue_to': '', }) self.user.confirm_token = 'mytoken' self.user.password = '******' context, request = root, DummyRequest(post={'submit': 'submit'}) res = set_password(context, request) assert self.user.confirm_token == 'mytoken' assert not get_principals().validate_password( 'mypassword', self.user.password) assert not request.is_response(res)
def test_wrong_token(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ 'token': 'wrongtoken', 'email': 'myemail', 'password': '******', 'continue_to': '', }) self.user.confirm_token = 'mytoken' self.user.password = '******' context, request = root, DummyRequest(post={'submit': 'submit'}) res = set_password(context, request) assert self.user.confirm_token == 'mytoken' assert not get_principals().validate_password('mypassword', self.user.password) assert not request.is_response(res)
def test_wrong_token(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ "token": "wrongtoken", "email": "myemail", "password": "******", "continue_to": "", }) self.user.confirm_token = "mytoken" self.user.password = "******" context, request = root, DummyRequest(post={"submit": "submit"}) res = set_password(context, request) assert self.user.confirm_token == "mytoken" assert not get_principals().validate_password("mypassword", self.user.password) assert not request.is_response(res)
def test_success(self): from kotti.resources import get_root from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ 'token': 'mytoken', 'email': 'myemail', 'password': '******', 'continue_to': '', }) self.user.confirm_token = 'mytoken' self.user.password = '******' context, request = get_root(), DummyRequest(post={'submit': 'submit'}) res = set_password(context, request) assert self.user.confirm_token is None assert get_principals().validate_password('mypassword', self.user.password) assert res.status == '302 Found'
def test_wrong_token(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values( { "token": "wrongtoken", "email": "myemail", "password": "******", "continue_to": "", } ) self.user.confirm_token = "mytoken" self.user.password = "******" context, request = root, DummyRequest(post={"submit": "submit"}) res = set_password(context, request) assert self.user.confirm_token == "mytoken" assert not get_principals().validate_password("mypassword", self.user.password) assert not request.is_response(res)
def test_success(self): from kotti.resources import get_root from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ 'token': 'mytoken', 'email': 'myemail', 'password': '******', 'continue_to': '', }) self.user.confirm_token = 'mytoken' self.user.password = '******' context, request = get_root(), DummyRequest(post={'submit': 'submit'}) res = set_password(context, request) assert self.user.confirm_token is None assert get_principals().validate_password( 'mypassword', self.user.password) assert res.status == '302 Found'
def test_success(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ "token": "mytoken", "email": "myemail", "password": "******", "continue_to": "", }) self.user.confirm_token = "mytoken" self.user.password = "******" context, request = root, DummyRequest(post={"submit": "submit"}) self.user.last_login_date = None res = set_password(context, request) assert self.user.confirm_token is None assert self.user.last_login_date is not None assert get_principals().validate_password("mypassword", self.user.password) assert res.status == "302 Found"
def test_success(self, root): from kotti.security import get_principals from kotti.views.login import set_password self.form_values( { "token": "mytoken", "email": "myemail", "password": "******", "continue_to": "", } ) self.user.confirm_token = "mytoken" self.user.password = "******" context, request = root, DummyRequest(post={"submit": "submit"}) self.user.last_login_date = None res = set_password(context, request) assert self.user.confirm_token is None assert self.user.last_login_date is not None assert get_principals().validate_password("mypassword", self.user.password) assert res.status == "302 Found"
def test_inactive_user(self, db_session): from kotti.resources import get_root from kotti.security import get_principals from kotti.views.login import set_password self.form_values({ 'token': 'mytoken', 'email': 'myemail', 'password': '******', 'continue_to': '', }) self.user.confirm_token = 'mytoken' self.user.password = '******' context, request = get_root(), DummyRequest(post={'submit': 'submit'}) self.user.active = False self.user.last_login_date = None res = set_password(context, request) assert self.user.confirm_token == 'mytoken' assert self.user.last_login_date is None assert not get_principals().validate_password( 'mypassword', self.user.password) assert not request.is_response(res)