コード例 #1
0
 def test_load_conf_bom(self):
     
     ra = RadiusAuth()
     
     ra.loadConf("test_load_conf_bom")
     
     self.assertEqual(ra.server, "auth.server1.acme.com")
     self.assertEqual(ra.secret, "changeme")
     
     self.assertEqual(ra.roles_attribute_id, 1)
     self.assertEqual(ra.vendor_code, 0)
コード例 #2
0
 def test_load_conf(self):
     
     ra = RadiusAuth()
     
     ra.loadConf("test_load_conf")
     
     self.assertEqual(ra.server, "auth.server1.acme.com")
     self.assertEqual(ra.secret, "changeme")
     self.assertEqual(ra.backup_server, "auth.server2.acme.com")
     self.assertEqual(ra.backup_server_secret, "changeme2")
     self.assertEqual(ra.identifier, "server1")
コード例 #3
0
 def test_load_conf_non_defaults(self):
     
     ra = RadiusAuth()
     
     ra.loadConf("test_load_conf_customizations")
     
     self.assertEqual(ra.server, "auth.server1.acme.com")
     self.assertEqual(ra.secret, "changeme")
     self.assertEqual(ra.identifier, "server1")
     
     self.assertEqual(ra.roles_key, "25,")
     
     self.assertEqual(sorted(ra.default_roles), sorted(["analyst", "manager"]))
コード例 #4
0
 def test_load_conf_vendor_attribute_invalid(self):
     
     ra = RadiusAuth()
     
     ra.loadConf("test_load_conf_vendor_attribute_invalid")
     
     self.assertEqual(ra.server, "auth.server1.acme.com")
     self.assertEqual(ra.secret, "changeme")
     self.assertEqual(ra.identifier, "server1")
     
     self.assertEqual(ra.roles_key, None)
     self.assertEqual(ra.roles_attribute_id, 1)
     self.assertEqual(ra.vendor_code, 0)
     
     self.assertEqual(sorted(ra.default_roles), sorted(["analyst", "manager"]))