def test_user_voucher_None(self): result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual( result[1][0], ('Reply-Message', 'User account or Voucher does not exist.'))
def test_user_inactive(self): self.user.is_active = False self.user.save() result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'User Inactive'))
def test_user_password_incorrect(self): self.user.set_password('00000') self.user.save() result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'User Password Incorrect'))
def test_authorize_response(self): result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 2) self.assertEqual(result[1][0][0], 'Session-Timeout') self.assertEqual(result[1][1][0], 'Acct-Interim-Interval') self.assertEqual(result[1][2][0], 'Maximum-Data-Rate-Upstream') self.assertEqual(result[1][3][0], 'Maximum-Data-Rate-Downstream')
def test_user_unauthorized(self): self.ap.status = 'PRV' self.ap.save() result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'User Unauthorized.'))
def test_voucher_password_incorrect(self): self.voucher.value = md5_password('00000') self.voucher.save() result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'Voucher Password Incorrect'))
def test_user_has_no_subscription(self): result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ( 'Reply-Message', "You have no subscription. Click 'Manage Account' below to recharge your account and purchase a package." ))
def test_ap_not_found(self): p = ( ('Called-Station-Id', '"00-18-0A-F2-DE-18:Radius test"'), ) result = rules.authorize(p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'AP Not Found. Please call customer care.'))
def test_ap_not_found(self): p = (('Called-Station-Id', '"00-18-0A-F2-DE-18:Radius test"'), ) result = rules.authorize(p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual( result[1][0], ('Reply-Message', 'AP Not Found. Please call customer care.'))
def test_user_has_no_subscription(self): result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', "You have no subscription. Click 'Manage Account' below to recharge your account and purchase a package."))
def test_user_voucher_None(self): result = rules.authorize(self.p) self.assertEqual(len(result), 3) self.assertEqual(result[0], 0) self.assertEqual(result[1][0], ('Reply-Message', 'User account or Voucher does not exist.'))