603 |
603 |
redirect = Redirect(old_url='/whatever/', page=page3)
|
604 |
604 |
redirect.save()
|
605 |
605 |
|
606 |
|
assert urlparse(app.get('/whatever/', status=301).location).path == '/second/third/'
|
|
606 |
assert urlparse(app.get('/whatever/', status=302).location).path == '/second/third/'
|
607 |
607 |
assert urlparse(app.get('/whatever', status=301).location).path == '/whatever/'
|
608 |
608 |
|
609 |
609 |
# check the most recent redirect is called
|
610 |
610 |
redirect = Redirect(old_url='/whatever/', page=page2)
|
611 |
611 |
redirect.save()
|
612 |
|
assert urlparse(app.get('/whatever/', status=301).location).path == '/second/'
|
|
612 |
assert urlparse(app.get('/whatever/', status=302).location).path == '/second/'
|
613 |
613 |
|
614 |
614 |
# rename page
|
615 |
615 |
page3.slug = 'third2'
|
616 |
616 |
page3.save()
|
617 |
617 |
assert app.get('/second/third2/', status=200)
|
618 |
|
assert urlparse(app.get('/second/third/', status=301).location).path == '/second/third2/'
|
|
618 |
assert urlparse(app.get('/second/third/', status=302).location).path == '/second/third2/'
|
619 |
619 |
|
620 |
620 |
page2.slug = 'second2'
|
621 |
621 |
page2.save()
|
622 |
|
assert urlparse(app.get('/second/third/', status=301).location).path == '/second2/third2/'
|
623 |
|
assert urlparse(app.get('/second/third2/', status=301).location).path == '/second2/third2/'
|
624 |
|
assert urlparse(app.get('/second/', status=301).location).path == '/second2/'
|
|
622 |
assert urlparse(app.get('/second/third/', status=302).location).path == '/second2/third2/'
|
|
623 |
assert urlparse(app.get('/second/third2/', status=302).location).path == '/second2/third2/'
|
|
624 |
assert urlparse(app.get('/second/', status=302).location).path == '/second2/'
|
625 |
625 |
|
626 |
626 |
# change parent
|
627 |
627 |
page3.parent = None
|
628 |
628 |
page3.save()
|
629 |
|
assert urlparse(app.get('/second/third/', status=301).location).path == '/third2/'
|
630 |
|
assert urlparse(app.get('/second2/third2/', status=301).location).path == '/third2/'
|
|
629 |
assert urlparse(app.get('/second/third/', status=302).location).path == '/third2/'
|
|
630 |
assert urlparse(app.get('/second2/third2/', status=302).location).path == '/third2/'
|
631 |
|
-
|