authentik.flows.tests.test_challenges

flow views tests

 1"""flow views tests"""
 2
 3from django.test import TestCase
 4
 5from authentik.flows.challenge import AutosubmitChallenge
 6
 7
 8class TestChallenges(TestCase):
 9    """Test generic challenges"""
10
11    def test_autosubmit_blank(self):
12        """Test blank autosubmit"""
13        challenge = AutosubmitChallenge(
14            data={
15                "url": "http://localhost",
16                "attrs": {},
17            }
18        )
19        self.assertTrue(challenge.is_valid(raise_exception=True))
20        # Test with an empty value
21        challenge = AutosubmitChallenge(
22            data={
23                "url": "http://localhost",
24                "attrs": {"foo": ""},
25            }
26        )
27        self.assertTrue(challenge.is_valid(raise_exception=True))
class TestChallenges(django.test.testcases.TestCase):
 9class TestChallenges(TestCase):
10    """Test generic challenges"""
11
12    def test_autosubmit_blank(self):
13        """Test blank autosubmit"""
14        challenge = AutosubmitChallenge(
15            data={
16                "url": "http://localhost",
17                "attrs": {},
18            }
19        )
20        self.assertTrue(challenge.is_valid(raise_exception=True))
21        # Test with an empty value
22        challenge = AutosubmitChallenge(
23            data={
24                "url": "http://localhost",
25                "attrs": {"foo": ""},
26            }
27        )
28        self.assertTrue(challenge.is_valid(raise_exception=True))

Test generic challenges

def test_autosubmit_blank(self):
12    def test_autosubmit_blank(self):
13        """Test blank autosubmit"""
14        challenge = AutosubmitChallenge(
15            data={
16                "url": "http://localhost",
17                "attrs": {},
18            }
19        )
20        self.assertTrue(challenge.is_valid(raise_exception=True))
21        # Test with an empty value
22        challenge = AutosubmitChallenge(
23            data={
24                "url": "http://localhost",
25                "attrs": {"foo": ""},
26            }
27        )
28        self.assertTrue(challenge.is_valid(raise_exception=True))

Test blank autosubmit