mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Store passwords in secureJsonData * Revert unnecessary refactors * Fix for nil jsonSecureData value * Remove copied encryption code from migration * Fix wrong field reference * Remove migration and provisioning changes * Use password getters in datasource proxy * Refactor password handling in datasource configs * Add provisioning warnings * Update documentation * Remove migration command, moved to separate PR * Remove unused code * Set the upgrade version * Remove unused code * Remove double reference
36 lines
839 B
TypeScript
36 lines
839 B
TypeScript
import { createResetHandler, PasswordFieldEnum, Ctrl } from './passwordHandlers';
|
|
|
|
describe('createResetHandler', () => {
|
|
Object.keys(PasswordFieldEnum).forEach(fieldKey => {
|
|
const field = PasswordFieldEnum[fieldKey];
|
|
|
|
it(`should reset existing ${field} field`, () => {
|
|
const event: any = {
|
|
preventDefault: () => {},
|
|
};
|
|
const ctrl: Ctrl = {
|
|
current: {
|
|
[field]: 'set',
|
|
secureJsonData: {
|
|
[field]: 'set',
|
|
},
|
|
secureJsonFields: {},
|
|
},
|
|
};
|
|
|
|
createResetHandler(ctrl, field)(event);
|
|
expect(ctrl).toEqual({
|
|
current: {
|
|
[field]: null,
|
|
secureJsonData: {
|
|
[field]: '',
|
|
},
|
|
secureJsonFields: {
|
|
[field]: false,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
});
|
|
});
|