Skip to content
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

Fix: Failing alert test #4225

Closed
wants to merge 2 commits into from
Closed

Fix: Failing alert test #4225

wants to merge 2 commits into from

Conversation

ranbena
Copy link
Contributor

@ranbena ranbena commented Oct 7, 2019

  • Bug Fix

Description

Fixes alert test failure.

The bug

When email server is configured in Redash, user creation api omits invite_link which the test was dependent on.
I assume this succeeded in the feature branch tests cause it wasn't up to date with #4173.

The fix

Added no_invite to api request and now the invite_link does appear and test continues.
Also added clear error if this prop doesn't show up in the future.

@ranbena ranbena marked this pull request as ready for review October 7, 2019 18:29
@ranbena ranbena requested a review from arikfr October 7, 2019 18:30
@ranbena ranbena self-assigned this Oct 7, 2019
@arikfr
Copy link
Member

arikfr commented Oct 7, 2019

I assume this succeeded in the feature branch tests cause it wasn't up to date with #4173.

This is correct, but not for the reason you think: the default setting in #4173 broke the "is email server configured" test 🤕 I will fix this.

@ranbena
Copy link
Contributor Author

ranbena commented Oct 8, 2019

@arikfr #4226 is important but not a replacement - this commit makes the test independent of the environment setting, therefore I think a must.

@arikfr
Copy link
Member

arikfr commented Oct 8, 2019 via email

@ranbena
Copy link
Contributor Author

ranbena commented Oct 8, 2019

How about returning invite_link in both cases?

invite_url = invite_link_for_user(user)
if settings.email_server_is_configured() and send_email:
send_invite_email(inviter, user, invite_url, org)
else:
d['invite_link'] = invite_url
return d

@arikfr
Copy link
Member

arikfr commented Oct 8, 2019 via email

@ranbena
Copy link
Contributor Author

ranbena commented Oct 8, 2019

If email can be sent or not.

invite_url = invite_link_for_user(user) 
if settings.email_server_is_configured() and send_email: 
  send_invite_email(inviter, user, invite_url, org) 
 
d['invite_link'] = invite_url   
return d 

@arikfr
Copy link
Member

arikfr commented Oct 10, 2019

You missed the point: with the way things implemented right now (using an invite link validates email address), we shouldn't be sharing the invite URL if email server is enabled.

But I thought about it some more and I think that what we can do is:

  1. Stop validating email address when using an invite URL and always send a validation email after creating the user/after the user signs in the first time (depends on flow).
  2. Once 1 is implemented, we can always return the invite URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants