You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/11/09 10:46:51 UTC
[GitHub] [superset] michael-s-molina commented on a change in pull request #17106: fix(dashboard): don't show report modal for anonymous user
michael-s-molina commented on a change in pull request #17106:
URL: https://github.com/apache/superset/pull/17106#discussion_r745496348
##########
File path: superset-frontend/src/dashboard/components/Header/Header.test.tsx
##########
@@ -465,4 +465,31 @@ describe('Email Report Modal', () => {
// BLOCKER: I cannot get report to populate, as its data is handled through redux
expect.anything();
});
+
+ it('Should render report header', async () => {
+ const mockedProps = createProps();
+ render(setup(mockedProps));
+ expect(
+ screen.getByRole('button', { name: 'Schedule email report' }),
+ ).toBeInTheDocument();
+ });
+
+ it('Should not render report header even with menu access for anonymous user', async () => {
+ const mockedProps = createProps();
+ const anonymousUserProps = {
+ ...mockedProps,
+ user: {
+ roles: {
+ Public: [['menu_access', 'Manage']],
+ },
+ permissions: {
+ datasource_access: ['[examples].[birth_names](id:2)'],
+ },
+ },
+ };
+ render(setup(anonymousUserProps));
+ expect(() =>
+ screen.getByRole('button', { name: 'Schedule email report' }),
+ ).toThrowError('Unable to find');
Review comment:
Can we change this to `queryByRole` and `not.toBeInTheDocument`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org