Example #1
0
 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.'))
Example #2
0
    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'))
Example #3
0
    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'))
Example #4
0
 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')
Example #5
0
    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.'))
Example #6
0
    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'))
Example #7
0
    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'))
Example #8
0
 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."
     ))
Example #9
0
 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')
Example #10
0
    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.'))
Example #11
0
    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.'))
Example #12
0
    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'))
Example #13
0
    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'))
Example #14
0
    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.'))
Example #15
0
 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."))
Example #16
0
 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.'))