def test_valid_when_verified(self, client): verify_service = client.api.boku.verify_service.post verify_service.return_value = '' form = forms_payments.BokuAccountForm({'account_name': 'Boku Acct', 'service_id': 'clearly-valid'}) ok_(form.is_valid()) verify_service.assert_called_with({'service_id': 'clearly-valid'})
def test_invalid_when_not_verified(self, client): verify_service = client.api.boku.verify_service.post verify_service.side_effect = HttpClientError form = forms_payments.BokuAccountForm({'account_name': 'Boku Acct', 'service_id': 'not-valid'}) ok_(not form.is_valid()) eq_(len(form.errors['service_id']), 1) verify_service.assert_called_with({'service_id': 'not-valid'})