mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
Fixed multi credential service unit test failures
Signed-off-by: mabashian <mabashia@redhat.com>
This commit is contained in:
parent
f90771ee1a
commit
549737405b
@ -138,7 +138,7 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
name: cred.name,
|
||||
id: cred.id,
|
||||
postType: cred.postType,
|
||||
readOnly: cred.readOnly,
|
||||
readOnly: cred.readOnly ? true : false,
|
||||
kind: typeOpts
|
||||
.filter(type => {
|
||||
return parseInt(cred.credential_type) === type.value;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
describe('MultiCredentialService', () => {
|
||||
let MultiCredentialService;
|
||||
@ -79,7 +79,7 @@ describe('MultiCredentialService', () => {
|
||||
expect(equal).toBe(true);
|
||||
});
|
||||
|
||||
it('should return array of selected credentials (populated)', () => {
|
||||
it('should return array of selected credentials (populated, not read only)', () => {
|
||||
let creds = {
|
||||
machine: {
|
||||
credential_type: 1,
|
||||
@ -120,18 +120,92 @@ describe('MultiCredentialService', () => {
|
||||
name: 'ssh',
|
||||
id: 3,
|
||||
postType: 'machine',
|
||||
readOnly: false,
|
||||
kind: 'SSH:'
|
||||
},
|
||||
{
|
||||
name: 'aws',
|
||||
id: 4,
|
||||
postType: 'extra',
|
||||
readOnly: false,
|
||||
kind: 'Amazon Web Services:'
|
||||
},
|
||||
{
|
||||
name: 'gce',
|
||||
id: 5,
|
||||
postType: 'extra',
|
||||
readOnly: false,
|
||||
kind: 'Google Compute Engine:'
|
||||
}
|
||||
];
|
||||
|
||||
let actual = MultiCredentialService
|
||||
.updateCredentialTags(creds, typeOpts);
|
||||
|
||||
let equal = _.isEqual(expected.sort(), actual.sort());
|
||||
|
||||
expect(equal).toBe(true);
|
||||
});
|
||||
|
||||
it('should return array of selected credentials (populated, read only)', () => {
|
||||
let creds = {
|
||||
machine: {
|
||||
credential_type: 1,
|
||||
id: 3,
|
||||
name: 'ssh',
|
||||
readOnly: true
|
||||
},
|
||||
extra: [
|
||||
{
|
||||
credential_type: 2,
|
||||
id: 4,
|
||||
name: 'aws',
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
credential_type: 3,
|
||||
id: 5,
|
||||
name: 'gce',
|
||||
readOnly: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let typeOpts = [
|
||||
{
|
||||
name: 'SSH',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: 'Amazon Web Services',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: 'Google Compute Engine',
|
||||
value: 3
|
||||
}
|
||||
];
|
||||
|
||||
let expected = [
|
||||
{
|
||||
name: 'ssh',
|
||||
id: 3,
|
||||
postType: 'machine',
|
||||
readOnly: true,
|
||||
kind: 'SSH:'
|
||||
},
|
||||
{
|
||||
name: 'aws',
|
||||
id: 4,
|
||||
postType: 'extra',
|
||||
readOnly: true,
|
||||
kind: 'Amazon Web Services:'
|
||||
},
|
||||
{
|
||||
name: 'gce',
|
||||
id: 5,
|
||||
postType: 'extra',
|
||||
readOnly: true,
|
||||
kind: 'Google Compute Engine:'
|
||||
}
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user