zhongrj
2025-11-24 276323dce9613867abb3f58a4cc2abbfb2fd0dea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from django.test import Client
from webodm import settings
from .classes import BootTestCase
 
class TestLogin(BootTestCase):
 
    def setUp(self):
        pass
 
    def tearDown(self):
        pass
 
    def test_reset_password_render(self):
        c = Client()
        c.login(username="testuser", password="test1234")
 
        settings.RESET_PASSWORD_LINK = ''
 
        res = c.get('/login/', follow=True)
        body = res.content.decode("utf-8")
 
        # The reset password link should show instructions
        self.assertTrue("You can reset the administrator password" in body)
 
        settings.RESET_PASSWORD_LINK = 'http://0.0.0.0/reset_test'
 
        res = c.get('/login/', follow=True)
        body = res.content.decode("utf-8")
 
        # The reset password link is a link
        self.assertTrue('<a href="http://0.0.0.0/reset_test' in body)