-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do not overwrite the stored password with the masked password #1209
do not overwrite the stored password with the masked password #1209
Conversation
Looks like something is wrong wrt usage of sqlalchemy in your test UPDATE: or not, #1208 has the same error on a different test :| |
I'll try to look deeper at this in the next couple of days. Most likely the test I added is doing something wrong. I looked at how other tests were structured and took my best guess. I agree it is strange that #1208 has a similar error. |
url = 'databaseview/edit/{}'.format(database.id) | ||
data = {k: database.__getattribute__(k) for k in DatabaseView.add_columns} | ||
data['sqlalchemy_uri'] = database.safe_sqlalchemy_uri() | ||
response = self.client.post(url, data=data) |
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.
I believe you are getting an error here because the database object is modified in the post request and sql alchemy cannot fetch new attributes.
you could try to requery the object after the post request.
data = {k: database.__getattribute__(k) for k in DatabaseView.add_columns} | ||
data['sqlalchemy_uri'] = database.safe_sqlalchemy_uri() | ||
response = self.client.post(url, data=data) | ||
assert sqlalchemy_uri_decrypted == database.sqlalchemy_uri_decrypted |
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.
could you please use self.assertEquals instead of assert?
assertEquals gives a nice error message in case of the mismatch
Hmm, this is a new build failure after I clicked "update branch". The previous CI build did succeed. I'm not sure if this was from complications from merging 4164d6c or if this is a problem in master brought into this PR by updating the branch. |
that looks like transient error |
please rebase your branch, otherwise LGTM |
his addresses issue apache#1199
…i does not over-write the stored sqlalchemy_uri
use self.assertEqual for more informative error messages.
4282718
to
669612f
Compare
Rebased and dealt with the merge conflict in tests/core_tests.py |
Thanks for following through @dennisobrien ! |
This addresses #1199
The fixes a common case of editing a database connection by changing something in the "extra" json but leaving the sqlalchemy uri as-is (and password-masked). Saving this would result in the password being updated with "XXXXXXXXXX". This only updates the password if it is not the password mask.
Added a test as well.