-
Notifications
You must be signed in to change notification settings - Fork 308
Conversation
All credit here is to the good work of @matthewfl |
Could we drop the email while we are changing the code around it? Please see #453. |
things = getattr(self._account, self.thing_type+'s').all() | ||
things = [thing for thing in things if thing.is_valid] | ||
things = getattr(self._customer, self.thing_type+'s')\ | ||
.filter(is_valid=True).all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in 1.1 is_valid is a default filter, no need to explicitly pass it unless you want is_valid=False
@matthewfl looking good! I suggest we add a backwards compatibility test since this isn't testing an account uri being used with a customer. If you create a customer and munge the stored href from |
except balanced.exc.HTTPError as err: | ||
error = err.message.decode('UTF-8') # XXX UTF-8? | ||
error = err.message.message.decode('UTF-8') # XXX UTF-8? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahmoudimus @matthewfl @mjallday Thanks for the PR! :-) |
@@ -35,15 +35,16 @@ def get_balanced_account(db, username, balanced_account_uri): | |||
# XXX Balanced requires an email address | |||
# https://github.com/balanced/balanced-api/issues/20 | |||
# quote to work around https://github.com/gittip/www.gittip.com/issues/781 | |||
# emails are not required for customers any more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to dropping email if we can here, as @zwn suggests at #2036 (comment). Our ticket for this: #453.
I will drop the email requirement as @zwn pointed out. I plan to add a few more tests for the payday scripts as I noticed that there were a number of lines that were not being covered. |
Update: I have removed the email constraint, and have tested adding cards and bank accounts and they both appear to work. Additionally, I added a Last four of ssn field on the bank account. I am not sure what the communities opinion is with respect to having this information, however if a user is having a hard time confirming their identity, then including the last four digits of their ssn often greatly improves their chances of a match. As for tests, there is a test for balanced which checks that old urls can be used. Balanced has a fix for this going public shortly, but in the mean time this test is expected to fail. |
Currently we direct the user to Balanced if the identity verification fails with basic info. I would love it if we could keep the user on our site for this escalation, but I'd rather not present them with an SSN field unless verification fails without it. |
@matthewfl Can you look into why Travis is failing? |
@whit537 Balanced is removing the support for the redirect to our site. With customers, instead of throwing an error when the match fails, the merchant status on the customer will simply report there is not a match. This means the site can continue to resubmit information. One of the failures is the test that I referenced above |
Ah, got it, okay. I'll take a look at the UX for this ... |
@matthewfl there's a couple of python libraries similar to ruby's VCR which would fit the build here. Betamax and VCRpy both can make the actual http call and record the response for later testing. Best of both worlds potentially?
|
@whit537 using @mjallday suggestion, I was able to reduce the time it takes the tests to run. For me, this is even a little faster than running the tests on the master branch. |
That's awesome @matthewfl, thank you. @seanlinsley Weren't you talking about VCR in some other context? Was that you? |
I've used the Ruby version of VCR before, but I don't think I've mentioned it here 🐙 |
VCR is way cool. :-)
|
In #2036 we sprouted the ability to record HTTP sessions during testing and then reuse the result of those sessions in subsequent tests. This is done via the VCR library (a port from Ruby). Storing the cache in the repo doesn't seem quite right to me, so in this PR I'm proposing we take it out. The implication is that the first run of the test suite will take a loooong time to prime the cache. Subsequent runs should be an order of magnitude faster (back down near where we were before).
In #2036 we upgraded to the 1.1 version of the Balanced API. This commit propagates nomenclature changes down into the database, for a consistent developer experience.
In #2036 we started using VCR to freeze HTTP API calls into test fixtures. This is great! Let's do more of that! This commit moves the VCR configuration upstream from where it began (in test_billing.py) into the gittip.testing.Harness class. Now all tests can make expensive HTTP API calls with impunity. In fact, this knocks out a XXX comment, because we had one API call elsewhere in the test suite. VCR transparently took care of it for us! I was quite pleasantly surprised to find TestPages.yml. Yay VCR! :-) My first motivation in doing this, however, was to be able to write a test for regression I'm seeing with payday (#2057). Onward!
These address regressions introduced by #2036.
mp = balanced.Marketplace.my_marketplace | ||
if not mp: | ||
mp = balanced.Marketplace().save() | ||
o.balanced_marketplace = mp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from: #2112 (comment)
Is it really the best idea to build a new API key & secret every time you run the test suite? It seems like that produces unnecessary churn in the git history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At Balanced we do this on every test run. It's an easy way to ensure that we've got a clean slate before we begin and hitting the API means you're guaranteed that whatever the server is doing is compatible with your code. Generally I'd recommend doing that if you're interacting with the Balanced API, the fact that gittip is checking in fixture data makes the commits really large whenever it changes however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the upgrade to the balanced library in #2036 we no longer need this workaround for balanced/balanced-python#5. Removing at this point because I'm ripping out all of our direct os.environ usage and this applies.
With the upgrade to the balanced library in #2036 we no longer need this workaround for balanced/balanced-python#5. Removing at this point because I'm ripping out all of our direct os.environ usage and this applies.
This starts the process of upgrading Gittip to revision 1.1 of the API and moves Gittip away from "legacy Accounts" to "Customers"