Exemplo n.º 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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'))
Exemplo n.º 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'))
Exemplo n.º 9
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
                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'))
Exemplo n.º 10
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
                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.'))
Exemplo n.º 11
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)
Exemplo n.º 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)
Exemplo n.º 13
0
 def test_verify_alpha_pin(self):
     assert 'pin' in client.verify_pin(self.uuid, 'lame')['errors']
Exemplo n.º 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']
Exemplo n.º 15
0
 def test_verify_alpha_pin(self):
     assert "pin" in client.verify_pin(self.uuid, "lame")["errors"]
Exemplo n.º 16
0
 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), {})
Exemplo n.º 17
0
 def test_verify_good_pin(self):
     assert client.verify_pin(self.uuid, self.pin)
Exemplo n.º 18
0
 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']
Exemplo n.º 19
0
 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']
Exemplo n.º 20
0
 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'))
Exemplo n.º 21
0
 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)
Exemplo n.º 22
0
 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']
Exemplo n.º 23
0
 def test_verify_alpha_pin(self):
     assert not client.verify_pin(self.uuid, 'lame')
Exemplo n.º 24
0
 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']
Exemplo n.º 25
0
    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.'))