예제 #1
0
 def test_reset_confirm_pin_with_bad_pin(self):
     uuid = 'reset_confirm_pin_bad_pin'
     new_pin = '1122'
     client.create_buyer(uuid, self.pin)
     client.set_new_pin(uuid, new_pin)
     assert client.reset_confirm_pin(uuid, new_pin)
     assert client.verify_pin(uuid, new_pin)
     assert not client.reset_confirm_pin(uuid, self.pin)
     assert client.verify_pin(uuid, new_pin)
예제 #2
0
파일: tests.py 프로젝트: raulmalea/webpay
 def test_reset_confirm_pin_with_good_pin(self):
     uuid = "reset_confirm_pin_good_pin"
     new_pin = "1122"
     client.create_buyer(uuid, self.pin)
     client.set_new_pin(uuid, new_pin)
     assert client.reset_confirm_pin(uuid, new_pin)
     assert client.verify_pin(uuid, new_pin)
예제 #3
0
 def test_change_pin_without_existing_pin(self):
     uuid = 'change_pin_without_existing_pin'
     new_pin = '1234'
     buyer = client.create_buyer(uuid)
     assert not buyer.get('pin')
     client.change_pin(uuid, new_pin)
     buyer = client.get_buyer(uuid)
     assert buyer.get('pin')
     assert client.verify_pin(uuid, new_pin)
예제 #4
0
 def test_change_pin_with_existing_pin(self):
     uuid = 'change_pin_with_existing_pin'
     pin = '5432'
     new_pin = pin[::-1]
     client.create_buyer(uuid, pin)
     client.change_pin(uuid, new_pin)
     buyer = client.get_buyer(uuid)
     assert buyer.get('pin')
     assert client.verify_pin(uuid, new_pin)
예제 #5
0
파일: tests.py 프로젝트: raulmalea/webpay
 def test_change_pin_with_existing_pin(self):
     uuid = "change_pin_with_existing_pin"
     pin = "5432"
     new_pin = pin[::-1]
     client.create_buyer(uuid, pin)
     client.change_pin(uuid, new_pin)
     buyer = client.get_buyer(uuid)
     assert buyer.get("pin")
     assert client.verify_pin(uuid, new_pin)
예제 #6
0
파일: tests.py 프로젝트: raulmalea/webpay
 def test_change_pin_without_existing_pin(self):
     uuid = "change_pin_without_existing_pin"
     new_pin = "1234"
     buyer = client.create_buyer(uuid)
     assert not buyer.get("pin")
     client.change_pin(uuid, new_pin)
     buyer = client.get_buyer(uuid)
     assert buyer.get("pin")
     assert client.verify_pin(uuid, new_pin)
예제 #7
0
파일: forms.py 프로젝트: wladow/webpay
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.handle_client_errors(res):
            if res.get('locked'):
                self.pin_is_locked = True
                # Not displayed to the user.
                raise forms.ValidationError('pin locked')
            elif res.get('valid'):
                return pin

        raise forms.ValidationError(_('Wrong pin'))
예제 #8
0
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.handle_client_errors(res):
            if res.get('locked'):
                self.pin_is_locked = True
                # Not displayed to the user.
                raise forms.ValidationError('pin locked')
            elif res.get('valid'):
                return pin

        raise forms.ValidationError(_('Wrong pin'))
예제 #9
0
파일: forms.py 프로젝트: ferjm/webpay
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.handle_client_errors(res):
            if res.get('locked'):
                self.pin_is_locked = True
                raise forms.ValidationError(_('Your PIN was entered '
                                              'incorrectly too many times. '
                                              'Sign in to continue.'))
            elif res.get('valid'):
                return pin

        raise forms.ValidationError(_('Wrong pin'))
예제 #10
0
파일: forms.py 프로젝트: AltisCorp/webpay
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.handle_client_errors(res):
            if res.get('locked'):
                self.pin_is_locked = True
                raise forms.ValidationError(_('Your PIN was entered '
                                              'incorrectly too many times. '
                                              'Sign in to continue.'))
            elif res.get('valid'):
                return pin

        raise forms.ValidationError(_('PIN does not match.'))
예제 #11
0
파일: forms.py 프로젝트: flodolo/webpay
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.client_response_is_valid(res):
            if res.get('locked'):
                self.pin_is_locked = True
                # Not displayed to the user.
                raise forms.ValidationError('pin locked')
            elif res.get('valid'):
                return pin

        self.add_error_code(msg.WRONG_PIN)
        raise forms.ValidationError(msg.WRONG_PIN)
예제 #12
0
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        res = client.verify_pin(self.uuid, pin)
        self.pin_is_locked = False
        if self.client_response_is_valid(res):
            if res.get('locked'):
                self.pin_is_locked = True
                # Not displayed to the user.
                raise forms.ValidationError('pin locked')
            elif res.get('valid'):
                return pin

        self.add_error_code(msg.WRONG_PIN)
        raise forms.ValidationError(msg.WRONG_PIN)
예제 #13
0
 def test_verify_alpha_pin(self):
     assert 'pin' in client.verify_pin(self.uuid, 'lame')['errors']
예제 #14
0
 def test_verify_without_confirm_and_good_pin(self):
     uuid = 'verify_pin_good_pin'
     client.create_buyer(uuid, self.pin)
     assert not client.verify_pin(uuid, self.pin)['valid']
예제 #15
0
파일: tests.py 프로젝트: raulmalea/webpay
 def test_verify_alpha_pin(self):
     assert "pin" in client.verify_pin(self.uuid, "lame")["errors"]
예제 #16
0
파일: tests.py 프로젝트: lonnen/webpay
 def test_change_pin(self):
     buyer_id = client.get_buyer(self.uuid)['id']
     eq_(client.change_pin(buyer_id, '4321'), {})
     assert client.verify_pin(self.uuid, '4321')
     eq_(client.change_pin(buyer_id, self.pin), {})
예제 #17
0
파일: tests.py 프로젝트: lonnen/webpay
 def test_verify_good_pin(self):
     assert client.verify_pin(self.uuid, self.pin)
예제 #18
0
파일: tests.py 프로젝트: lissyx/webpay
 def test_verify_alpha_pin(self, slumber):
     slumber.generic.verify_pin.post.side_effect = HttpClientError(
         response=self.create_error_response(
             content={'pin': ['PIN_ONLY_NUMBERS']}))
     assert 'pin' in client.verify_pin(self.uuid, 'lame')['errors']
예제 #19
0
파일: tests.py 프로젝트: lissyx/webpay
 def test_verify_pin_without_confirm(self, slumber):
     slumber.generic.verify_pin.post.return_value = {'valid': False}
     assert not client.verify_pin(self.uuid, self.pin)['valid']
예제 #20
0
파일: forms.py 프로젝트: lonnen/webpay
 def clean_old_pin(self, *args, **kwargs):
     old_pin = self.cleaned_data['old_pin']
     if self.handle_client_errors(client.verify_pin(self.uuid, old_pin)):
         self.buyer = self.handle_client_errors(client.get_buyer(self.uuid))
         return old_pin
     raise forms.ValidationError(_('Incorrect PIN'))
예제 #21
0
파일: tests.py 프로젝트: AltisCorp/webpay
 def test_verify_with_confirm_and_good_pin(self):
     uuid = 'verify_pin_confirm_pin_good_pin'
     client.create_buyer(uuid, self.pin)
     assert client.confirm_pin(uuid, self.pin)
     assert client.verify_pin(uuid, self.pin)
예제 #22
0
파일: tests.py 프로젝트: MorrisJobke/webpay
 def test_verify_pin_without_confirm(self, slumber):
     slumber.generic.verify_pin.post.return_value = {'valid': False}
     assert not client.verify_pin(self.uuid, self.pin)['valid']
예제 #23
0
파일: tests.py 프로젝트: AltisCorp/webpay
 def test_verify_alpha_pin(self):
     assert not client.verify_pin(self.uuid, 'lame')
예제 #24
0
파일: tests.py 프로젝트: MorrisJobke/webpay
 def test_verify_alpha_pin(self, slumber):
     slumber.generic.verify_pin.post.side_effect = HttpClientError(
         response=self.create_error_response(content={
             'pin': ['PIN_ONLY_NUMBERS']
         }))
     assert 'pin' in client.verify_pin(self.uuid, 'lame')['errors']
예제 #25
0
파일: forms.py 프로젝트: lonnen/webpay
    def clean_pin(self, *args, **kwargs):
        pin = self.cleaned_data['pin']
        if self.handle_client_errors(client.verify_pin(self.uuid, pin)):
            return pin

        raise forms.ValidationError(_('Incorrect PIN.'))