test(db): Add tests for inserts into target_credential_library
This commit is contained in:
1 parent
c4aa9a0358
commit
0512ddb060
1 file changed
+44
@@ -0,0 +1,44 @@
|
||||
begin;
|
||||
select plan(3);
|
||||
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'credentials');
|
||||
|
||||
-- validate the setup data
|
||||
select is(count(*), 1::bigint)
|
||||
from credential_library cl
|
||||
join credential_store cs on cl.store_id = cs.public_id
|
||||
where cs.scope_id = 'p____bwidget'
|
||||
and cs.public_id = 'vs_______wvs'
|
||||
and cl.public_id = 'vl______wvl1';
|
||||
|
||||
insert into target
|
||||
(scope_id, public_id)
|
||||
values
|
||||
('p____bwidget', 'test______wb');
|
||||
|
||||
prepare insert_valid_target_credential_library as
|
||||
insert into target_credential_library
|
||||
(target_id, credential_library_id, credential_purpose)
|
||||
values
|
||||
('test______wb', 'vl______wvl1', 'application');
|
||||
select lives_ok('insert_valid_target_credential_library', 'insert valid target_credential_library failed');
|
||||
|
||||
-- create a credential_store and credential_library in a different project
|
||||
insert into credential_store
|
||||
(scope_id, public_id)
|
||||
values
|
||||
('p____swidget', 'test______cs');
|
||||
|
||||
insert into credential_library
|
||||
(store_id, public_id, credential_type)
|
||||
values
|
||||
('test______cs', 'test______cl', 'unspecified');
|
||||
|
||||
prepare insert_invalid_target_credential_library as
|
||||
insert into target_credential_library
|
||||
(target_id, credential_library_id, credential_purpose)
|
||||
values
|
||||
('test______wb', 'test______cl', 'application');
|
||||
select throws_ok('insert_invalid_target_credential_library', '23000', null, 'insert invalid target_credential_library succeeded');
|
||||
|
||||
select * from finish();
|
||||
rollback;
|
||||
Reference in new issue
Block a user