@@ -1814,6 +1814,55 @@ def test_authorize_without_user_auth(self):
18141814 ),
18151815 )
18161816
1817+ def test_authorize_optional_fields (self ):
1818+ username = "tester"
1819+ password = "tester"
1820+ self ._create_user (
1821+ username = username ,
1822+ 1823+ password = "password" ,
1824+ )
1825+ authorize_path = reverse ("radius:authorize" )
1826+ payload = {"username" : username , "password" : password }
1827+ with self .subTest ("Test without called and calling station id" ):
1828+ response = self .client .post (
1829+ authorize_path ,
1830+ payload ,
1831+ HTTP_AUTHORIZATION = self .auth_header ,
1832+ content_type = "application/json" ,
1833+ )
1834+ self .assertEqual (response .status_code , 200 )
1835+
1836+ with self .subTest ("Test with empty called and calling station id" ):
1837+ payload .update (
1838+ {
1839+ "called_station_id" : "" ,
1840+ "calling_station_id" : "" ,
1841+ }
1842+ )
1843+ response = self .client .post (
1844+ authorize_path ,
1845+ payload ,
1846+ HTTP_AUTHORIZATION = self .auth_header ,
1847+ content_type = "application/json" ,
1848+ )
1849+ self .assertEqual (response .status_code , 200 )
1850+
1851+ with self .subTest ("Test with called and calling station id" ):
1852+ payload .update (
1853+ {
1854+ "called_station_id" : "00-11-22-33-44-55" ,
1855+ "calling_station_id" : "66-55-44-33-22-11" ,
1856+ }
1857+ )
1858+ response = self .client .post (
1859+ authorize_path ,
1860+ payload ,
1861+ HTTP_AUTHORIZATION = self .auth_header ,
1862+ content_type = "application/json" ,
1863+ )
1864+ self .assertEqual (response .status_code , 200 )
1865+
18171866 def test_user_auth_token_disposed_after_auth (self ):
18181867 self ._get_org_user ()
18191868 rad_token = self ._login_and_obtain_auth_token ()
0 commit comments