@@ -72,6 +72,7 @@ describe('discovery-v1', function() {
7272 '/v1/environments/env-guid/collections/col-guid/training_data/query-guid/examples/example-guid' ,
7373 queryRelations : '/v1/environments/env-guid/collections/col-guid/query_relations' ,
7474 queryEntities : '/v1/environments/env-guid/collections/col-guid/query_entities' ,
75+ credentials : '/v1/environments/env-guid/credentials' ,
7576 } ;
7677
7778 it ( 'should generate version was not specified (negative test)' , function ( ) {
@@ -875,6 +876,66 @@ describe('discovery-v1', function() {
875876 ) ;
876877 } ) ;
877878 } ) ;
879+ describe ( 'credentials tests' , function ( ) {
880+ it ( 'should create credentials' , function ( ) {
881+ const req = discovery . createCredentials (
882+ { environment_id : 'env-guid' , source_type : 'box' } ,
883+ noop
884+ ) ;
885+ assert . equal (
886+ req . uri . href ,
887+ service . url + paths . credentials + '?version=' + service . version
888+ ) ;
889+ assert . equal ( req . method , 'POST' ) ;
890+ assert . equal ( JSON . parse ( req . body ) . source_type , 'box' ) ;
891+ } ) ;
892+
893+ it ( 'should list credentials' , function ( ) {
894+ const req = discovery . listCredentials ( { environment_id : 'env-guid' } , noop ) ;
895+ assert . equal (
896+ req . uri . href ,
897+ service . url + paths . credentials + '?version=' + service . version
898+ ) ;
899+ assert . equal ( req . method , 'GET' ) ;
900+ } ) ;
901+
902+ it ( 'should get credentials' , function ( ) {
903+ const req = discovery . getSourceCredentials (
904+ { environment_id : 'env-guid' , credential_id : 'cred-guid' } ,
905+ noop
906+ ) ;
907+ assert . equal (
908+ req . uri . href ,
909+ service . url + paths . credentials + '/cred-guid?version=' + service . version
910+ ) ;
911+ assert . equal ( req . method , 'GET' ) ;
912+ } ) ;
913+
914+ it ( 'should update credentials' , function ( ) {
915+ const req = discovery . updateCredentials (
916+ { environment_id : 'env-guid' , credential_id : 'cred-guid' , source_type : 'sharepoint' } ,
917+ noop
918+ ) ;
919+ assert . equal (
920+ req . uri . href ,
921+ service . url + paths . credentials + '/cred-guid?version=' + service . version
922+ ) ;
923+ assert . equal ( req . method , 'PUT' ) ;
924+ assert . equal ( JSON . parse ( req . body ) . source_type , 'sharepoint' ) ;
925+ } ) ;
926+
927+ it ( 'should delete credentials' , function ( ) {
928+ const req = discovery . deleteCredentials (
929+ { environment_id : 'env-guid' , credential_id : 'cred-guid' } ,
930+ noop
931+ ) ;
932+ assert . equal (
933+ req . uri . href ,
934+ service . url + paths . credentials + '/cred-guid?version=' + service . version
935+ ) ;
936+ assert . equal ( req . method , 'DELETE' ) ;
937+ } ) ;
938+ } ) ;
878939 } ) ;
879940 } ) ;
880941 } ) ;
0 commit comments