def clean_pin(self, *args, **kwargs): pin = self.cleaned_data['pin'] if self.handle_client_errors(client.confirm_pin(self.uuid, pin)): return pin self.add_error_code('PINS_DONT_MATCH') raise forms.ValidationError(_("Pins do not match."))
def test_confirm_pin_with_bad_pin(self, slumber): slumber.generic.confirm_pin.post.return_value = {'confirmed': False} assert not client.confirm_pin(self.uuid, self.pin[::-1])
def test_confirm_pin_with_good_pin(self, slumber): slumber.generic.confirm_pin.post.return_value = {'confirmed': True} assert client.confirm_pin(self.uuid, self.pin)
def clean_pin(self, *args, **kwargs): pin = self.cleaned_data['pin'] if self.handle_client_errors(client.confirm_pin(self.uuid, pin)): return pin raise forms.ValidationError(_('PIN does not match.'))
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)['valid']
def test_confirm_pin_with_bad_pin(self): uuid = 'confirm_pin_bad_pin' client.create_buyer(uuid, self.pin) assert not client.confirm_pin(uuid, self.pin[::-1])
def test_confirm_pin_with_good_pin(self): uuid = 'confirm_pin_good_pin' client.create_buyer(uuid, self.pin) assert client.confirm_pin(uuid, self.pin)