mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
User profile pages (favorites, created content, recent activity, security & access) (#1615)
* Super * User profile page * Fixing python style * Python unit tests * Touchups and js tests * Addressing comments
This commit is contained in:
committed by
GitHub
parent
5ae98bc7c9
commit
7e1852ee88
35
superset/assets/spec/javascripts/profile/Security_spec.jsx
Normal file
35
superset/assets/spec/javascripts/profile/Security_spec.jsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import Security from '../../../javascripts/profile/components/Security';
|
||||
import { mount } from 'enzyme';
|
||||
import { describe, it } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { user, userNoPerms } from './fixtures';
|
||||
|
||||
|
||||
describe('Security', () => {
|
||||
const mockedProps = {
|
||||
user,
|
||||
};
|
||||
it('is valid', () => {
|
||||
expect(
|
||||
React.isValidElement(<Security {...mockedProps} />)
|
||||
).to.equal(true);
|
||||
});
|
||||
it('renders 2 role labels', () => {
|
||||
const wrapper = mount(<Security {...mockedProps} />);
|
||||
expect(wrapper.find('.roles').find('.label')).to.have.length(2);
|
||||
});
|
||||
it('renders 2 datasource labels', () => {
|
||||
const wrapper = mount(<Security {...mockedProps} />);
|
||||
expect(wrapper.find('.datasources').find('.label')).to.have.length(2);
|
||||
});
|
||||
it('renders 3 database labels', () => {
|
||||
const wrapper = mount(<Security {...mockedProps} />);
|
||||
expect(wrapper.find('.databases').find('.label')).to.have.length(3);
|
||||
});
|
||||
it('renders no permission label when empty', () => {
|
||||
const wrapper = mount(<Security user={userNoPerms} />);
|
||||
expect(wrapper.find('.datasources').find('.label')).to.have.length(0);
|
||||
expect(wrapper.find('.databases').find('.label')).to.have.length(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user