This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read localAuthEnabled config from backend (#44)
* teleport/Login.jsx - Login.jsx retrieves and sets isLocalAuthEnabled flag * teleport/config.js - add a localAuthEnabled prop to cfg.auth, defaulted to true - add a getter for localAuthEnabled * shared/FormLogin.jsx - receive isLocalAuthEnabled as prop - renders input and login elements based on isLocalAuthEnabled flag - update old story format - created snapshot testing based on story for testing render
- Loading branch information
Lisa Kim
authored
Mar 9, 2020
1 parent
3346274
commit 83f8c89
Showing
7 changed files
with
1,828 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/shared/components/FormLogin/FormLogin.story.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright 2020 Gravitational, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
Basic, | ||
ServerError, | ||
SSOProviders, | ||
Universal2ndFactor, | ||
LocalAuthDisabled, | ||
LocalAuthDisabledNoSSO, | ||
} from './FormLogin.story'; | ||
import { render } from 'design/utils/testing'; | ||
|
||
test('auth2faType: otp rendering', () => { | ||
const { container } = render(<Basic />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test('server error rendering', () => { | ||
const { container } = render(<ServerError />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test('sso providers rendering', () => { | ||
const { container } = render(<SSOProviders />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test('auth2faType: u2f rendering', () => { | ||
const { container } = render(<Universal2ndFactor />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test('nonrendering of user/pass/otp/login elements w/ local auth disabled', () => { | ||
const { container } = render(<LocalAuthDisabled />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test('nonrendering of SSO providers w/ local auth disabled and no providers', () => { | ||
const { container } = render(<LocalAuthDisabledNoSSO />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); |
Oops, something went wrong.