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

tests added for dashboard messages #92

Merged
merged 3 commits into from
Nov 10, 2022
Merged

Conversation

vishalpandeynits
Copy link
Contributor

@vishalpandeynits vishalpandeynits commented Nov 10, 2022

Tests added for authorization and dashboard of fyle slack UI.

Imrovement
dashboard's coverage -- 30% to 95%,
Total coverage -- 65% to 68%

Attesting the coverage report of files.
Screenshot from 2022-11-10 16-34-41


def test_pre_authorization_message(self):
pre_authorization_message = authorization.messages.get_pre_authorization_message(MOCK_USERNAME, FYLE_STOPLIGHT_URL)
assert type(pre_authorization_message) is list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we store the expected return value as fixture and assert with it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you think asserting the whole message will be overkill, we can just check specific parts of it, for example
'text': 'Hey there *{}* :wave:'.format(user_name), you can check if text has the expected value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work

for text_object in pre_authorization_message: 
    assert 'text' in text_object

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert pre_authorization_message[0]['text'] == 'Hey there *fake_username* :wave:'


def test_get_pre_authorization_message(self):
pre_authorization_message = authorization.messages.get_pre_authorization_message(MOCK_USERNAME, MOCK_FYLE_OAUTH_URL)
assert 'type' in pre_authorization_message[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as 1st comment

'url': MOCK_FYLE_OAUTH_URL
}
sent_back_reports_view = dashboard.messages.get_sent_back_reports_dashboard_view(mock_reports, 'INR')
assert type(sent_back_reports_view) is list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, can assert important keys that involves amount, count, etc

@vishalpandeynits vishalpandeynits merged commit ba8247c into master Nov 10, 2022
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