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)
def clean_pin(self, *args, **kwargs): pin = self.cleaned_data['pin'] if self.handle_client_errors(client.reset_confirm_pin(self.uuid, pin)): return pin self.add_error_code('PINS_DONT_MATCH') raise forms.ValidationError(_("Pins do not match."))
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)
def test_reset_confirm_pin_with_bad_pin(self, slumber): new_pin = '1122' buyer = mock.Mock(return_value=self.buyer_data) buyer.patch.return_value = {} slumber.generic.buyer.return_value = buyer client.set_new_pin(self.uuid, new_pin) slumber.generic.reset_confirm_pin.post.return_value = { 'confirmed': False } assert not client.reset_confirm_pin(self.uuid, new_pin)
def clean_pin(self, *args, **kwargs): pin = self.cleaned_data['pin'] if self.handle_client_errors(client.reset_confirm_pin(self.uuid, pin)): return pin raise forms.ValidationError(_('PIN does not match.'))