@@ -1433,7 +1433,7 @@ describe('File', function() {
14331433
14341434 it ( 'should create a signed policy' , function ( done ) {
14351435 file . getSignedPolicy ( {
1436- expires : Date . now ( ) + 5
1436+ expires : Date . now ( ) + 2000
14371437 } , function ( err , signedPolicy ) {
14381438 assert . ifError ( err ) ;
14391439 assert . equal ( typeof signedPolicy . string , 'string' ) ;
@@ -1445,7 +1445,7 @@ describe('File', function() {
14451445
14461446 it ( 'should not modify the configuration object' , function ( done ) {
14471447 var config = {
1448- expires : Date . now ( ) + 5
1448+ expires : Date . now ( ) + 2000
14491449 } ;
14501450
14511451 var originalConfig = extend ( { } , config ) ;
@@ -1466,7 +1466,7 @@ describe('File', function() {
14661466 } ;
14671467
14681468 file . getSignedPolicy ( {
1469- expires : Date . now ( ) + 5
1469+ expires : Date . now ( ) + 2000
14701470 } , function ( err ) {
14711471 assert . strictEqual ( err . name , 'SigningError' ) ;
14721472 assert . strictEqual ( err . message , error . message ) ;
@@ -1481,7 +1481,7 @@ describe('File', function() {
14811481 } ;
14821482
14831483 file . getSignedPolicy ( {
1484- expires : Date . now ( ) + 5
1484+ expires : Date . now ( ) + 2000
14851485 } , function ( err ) {
14861486 var errorMessage = [
14871487 'Could not find a `private_key`.' ,
@@ -1496,7 +1496,7 @@ describe('File', function() {
14961496
14971497 it ( 'should add key equality condition' , function ( done ) {
14981498 file . getSignedPolicy ( {
1499- expires : Date . now ( ) + 5
1499+ expires : Date . now ( ) + 2000
15001500 } , function ( err , signedPolicy ) {
15011501 var conditionString = '[\"eq\",\"$key\",\"' + file . name + '\"]' ;
15021502 assert . ifError ( err ) ;
@@ -1507,7 +1507,7 @@ describe('File', function() {
15071507
15081508 it ( 'should add ACL condtion' , function ( done ) {
15091509 file . getSignedPolicy ( {
1510- expires : Date . now ( ) + 5 ,
1510+ expires : Date . now ( ) + 2000 ,
15111511 acl : '<acl>'
15121512 } , function ( err , signedPolicy ) {
15131513 var conditionString = '{\"acl\":\"<acl>\"}' ;
@@ -1521,7 +1521,7 @@ describe('File', function() {
15211521 var redirectUrl = 'http://redirect' ;
15221522
15231523 file . getSignedPolicy ( {
1524- expires : Date . now ( ) + 5 ,
1524+ expires : Date . now ( ) + 2000 ,
15251525 successRedirect : redirectUrl
15261526 } , function ( err , signedPolicy ) {
15271527 assert . ifError ( err ) ;
@@ -1539,7 +1539,7 @@ describe('File', function() {
15391539 var successStatus = '200' ;
15401540
15411541 file . getSignedPolicy ( {
1542- expires : Date . now ( ) + 5 ,
1542+ expires : Date . now ( ) + 2000 ,
15431543 successStatus : successStatus
15441544 } , function ( err , signedPolicy ) {
15451545 assert . ifError ( err ) ;
@@ -1607,7 +1607,7 @@ describe('File', function() {
16071607 describe ( 'equality condition' , function ( ) {
16081608 it ( 'should add equality conditions (array of arrays)' , function ( done ) {
16091609 file . getSignedPolicy ( {
1610- expires : Date . now ( ) + 5 ,
1610+ expires : Date . now ( ) + 2000 ,
16111611 equals : [ [ '$<field>' , '<value>' ] ]
16121612 } , function ( err , signedPolicy ) {
16131613 var conditionString = '[\"eq\",\"$<field>\",\"<value>\"]' ;
@@ -1619,7 +1619,7 @@ describe('File', function() {
16191619
16201620 it ( 'should add equality condition (array)' , function ( done ) {
16211621 file . getSignedPolicy ( {
1622- expires : Date . now ( ) + 5 ,
1622+ expires : Date . now ( ) + 2000 ,
16231623 equals : [ '$<field>' , '<value>' ]
16241624 } , function ( err , signedPolicy ) {
16251625 var conditionString = '[\"eq\",\"$<field>\",\"<value>\"]' ;
@@ -1632,7 +1632,7 @@ describe('File', function() {
16321632 it ( 'should throw if equal condition is not an array' , function ( ) {
16331633 assert . throws ( function ( ) {
16341634 file . getSignedPolicy ( {
1635- expires : Date . now ( ) + 5 ,
1635+ expires : Date . now ( ) + 2000 ,
16361636 equals : [ { } ]
16371637 } , function ( ) { } ) ;
16381638 } , / E q u a l s c o n d i t i o n m u s t b e a n a r r a y o f 2 e l e m e n t s \. / ) ;
@@ -1641,7 +1641,7 @@ describe('File', function() {
16411641 it ( 'should throw if equal condition length is not 2' , function ( ) {
16421642 assert . throws ( function ( ) {
16431643 file . getSignedPolicy ( {
1644- expires : Date . now ( ) + 5 ,
1644+ expires : Date . now ( ) + 2000 ,
16451645 equals : [ [ '1' , '2' , '3' ] ]
16461646 } , function ( ) { } ) ;
16471647 } , / E q u a l s c o n d i t i o n m u s t b e a n a r r a y o f 2 e l e m e n t s \. / ) ;
@@ -1651,7 +1651,7 @@ describe('File', function() {
16511651 describe ( 'prefix conditions' , function ( ) {
16521652 it ( 'should add prefix conditions (array of arrays)' , function ( done ) {
16531653 file . getSignedPolicy ( {
1654- expires : Date . now ( ) + 5 ,
1654+ expires : Date . now ( ) + 2000 ,
16551655 startsWith : [ [ '$<field>' , '<value>' ] ]
16561656 } , function ( err , signedPolicy ) {
16571657 var conditionString = '[\"starts-with\",\"$<field>\",\"<value>\"]' ;
@@ -1663,7 +1663,7 @@ describe('File', function() {
16631663
16641664 it ( 'should add prefix condition (array)' , function ( done ) {
16651665 file . getSignedPolicy ( {
1666- expires : Date . now ( ) + 5 ,
1666+ expires : Date . now ( ) + 2000 ,
16671667 startsWith : [ '$<field>' , '<value>' ]
16681668 } , function ( err , signedPolicy ) {
16691669 var conditionString = '[\"starts-with\",\"$<field>\",\"<value>\"]' ;
@@ -1676,7 +1676,7 @@ describe('File', function() {
16761676 it ( 'should throw if prexif condition is not an array' , function ( ) {
16771677 assert . throws ( function ( ) {
16781678 file . getSignedPolicy ( {
1679- expires : Date . now ( ) + 5 ,
1679+ expires : Date . now ( ) + 2000 ,
16801680 startsWith : [ { } ]
16811681 } , function ( ) { } ) ;
16821682 } , / S t a r t s W i t h c o n d i t i o n m u s t b e a n a r r a y o f 2 e l e m e n t s \. / ) ;
@@ -1685,7 +1685,7 @@ describe('File', function() {
16851685 it ( 'should throw if prefix condition length is not 2' , function ( ) {
16861686 assert . throws ( function ( ) {
16871687 file . getSignedPolicy ( {
1688- expires : Date . now ( ) + 5 ,
1688+ expires : Date . now ( ) + 2000 ,
16891689 startsWith : [ [ '1' , '2' , '3' ] ]
16901690 } , function ( ) { } ) ;
16911691 } , / S t a r t s W i t h c o n d i t i o n m u s t b e a n a r r a y o f 2 e l e m e n t s \. / ) ;
@@ -1695,7 +1695,7 @@ describe('File', function() {
16951695 describe ( 'content length' , function ( ) {
16961696 it ( 'should add content length condition' , function ( done ) {
16971697 file . getSignedPolicy ( {
1698- expires : Date . now ( ) + 5 ,
1698+ expires : Date . now ( ) + 2000 ,
16991699 contentLengthRange : { min : 0 , max : 1 }
17001700 } , function ( err , signedPolicy ) {
17011701 var conditionString = '[\"content-length-range\",0,1]' ;
@@ -1708,7 +1708,7 @@ describe('File', function() {
17081708 it ( 'should throw if content length has no min' , function ( ) {
17091709 assert . throws ( function ( ) {
17101710 file . getSignedPolicy ( {
1711- expires : Date . now ( ) + 5 ,
1711+ expires : Date . now ( ) + 2000 ,
17121712 contentLengthRange : [ { max : 1 } ]
17131713 } , function ( ) { } ) ;
17141714 } , / C o n t e n t L e n g t h R a n g e m u s t h a v e n u m e r i c m i n & m a x f i e l d s \. / ) ;
@@ -1717,7 +1717,7 @@ describe('File', function() {
17171717 it ( 'should throw if content length has no max' , function ( ) {
17181718 assert . throws ( function ( ) {
17191719 file . getSignedPolicy ( {
1720- expires : Date . now ( ) + 5 ,
1720+ expires : Date . now ( ) + 2000 ,
17211721 contentLengthRange : [ { min : 0 } ]
17221722 } , function ( ) { } ) ;
17231723 } , / C o n t e n t L e n g t h R a n g e m u s t h a v e n u m e r i c m i n & m a x f i e l d s \. / ) ;
@@ -1738,7 +1738,7 @@ describe('File', function() {
17381738 it ( 'should create a signed url' , function ( done ) {
17391739 file . getSignedUrl ( {
17401740 action : 'read' ,
1741- expires : Date . now ( ) + 5
1741+ expires : Date . now ( ) + 2000
17421742 } , function ( err , signedUrl ) {
17431743 assert . ifError ( err ) ;
17441744 assert . equal ( typeof signedUrl , 'string' ) ;
@@ -1749,7 +1749,7 @@ describe('File', function() {
17491749 it ( 'should not modify the configuration object' , function ( done ) {
17501750 var config = {
17511751 action : 'read' ,
1752- expires : Date . now ( ) + 5
1752+ expires : Date . now ( ) + 2000
17531753 } ;
17541754
17551755 var originalConfig = extend ( { } , config ) ;
@@ -1771,7 +1771,7 @@ describe('File', function() {
17711771
17721772 file . getSignedUrl ( {
17731773 action : 'read' ,
1774- expires : Date . now ( ) + 5
1774+ expires : Date . now ( ) + 2000
17751775 } , function ( err ) {
17761776 assert . strictEqual ( err . name , 'SigningError' ) ;
17771777 assert . strictEqual ( err . message , error . message ) ;
@@ -1787,7 +1787,7 @@ describe('File', function() {
17871787
17881788 file . getSignedUrl ( {
17891789 action : 'read' ,
1790- expires : Date . now ( ) + 5
1790+ expires : Date . now ( ) + 2000
17911791 } , function ( err ) {
17921792 var errorMessage = [
17931793 'Could not find a `private_key` or `client_email`.' ,
@@ -1803,7 +1803,7 @@ describe('File', function() {
18031803 it ( 'should URI encode file names' , function ( done ) {
18041804 directoryFile . getSignedUrl ( {
18051805 action : 'read' ,
1806- expires : Date . now ( ) + 5 ,
1806+ expires : Date . now ( ) + 2000 ,
18071807 } , function ( err , signedUrl ) {
18081808 assert ( signedUrl . indexOf ( encodeURIComponent ( directoryFile . name ) ) > - 1 ) ;
18091809 done ( ) ;
@@ -1814,7 +1814,7 @@ describe('File', function() {
18141814 var type = 'application/json' ;
18151815 directoryFile . getSignedUrl ( {
18161816 action : 'read' ,
1817- expires : Date . now ( ) + 5 ,
1817+ expires : Date . now ( ) + 2000 ,
18181818 responseType : type
18191819 } , function ( err , signedUrl ) {
18201820 assert ( signedUrl . indexOf ( encodeURIComponent ( type ) ) > - 1 ) ;
@@ -1827,7 +1827,7 @@ describe('File', function() {
18271827 var file = new File ( BUCKET , 'name' , { generation : generation } ) ;
18281828 file . getSignedUrl ( {
18291829 action : 'read' ,
1830- expires : Date . now ( ) + 5 ,
1830+ expires : Date . now ( ) + 2000 ,
18311831 } , function ( err , signedUrl ) {
18321832 assert ( signedUrl . indexOf ( encodeURIComponent ( generation ) ) > - 1 ) ;
18331833 done ( ) ;
@@ -1841,7 +1841,7 @@ describe('File', function() {
18411841 file . getSignedUrl ( {
18421842 action : 'read' ,
18431843 cname : host ,
1844- expires : Date . now ( ) + 5
1844+ expires : Date . now ( ) + 2000
18451845 } , function ( err , signedUrl ) {
18461846 assert . ifError ( err ) ;
18471847 assert . strictEqual ( signedUrl . indexOf ( host ) , 0 ) ;
@@ -1855,7 +1855,7 @@ describe('File', function() {
18551855 file . getSignedUrl ( {
18561856 action : 'read' ,
18571857 cname : host ,
1858- expires : Date . now ( ) + 5
1858+ expires : Date . now ( ) + 2000
18591859 } , function ( err , signedUrl ) {
18601860 assert . ifError ( err ) ;
18611861 assert . strictEqual ( signedUrl . indexOf ( host ) , - 1 ) ;
@@ -1870,7 +1870,7 @@ describe('File', function() {
18701870 var disposition = 'attachment; filename="fname.ext"' ;
18711871 directoryFile . getSignedUrl ( {
18721872 action : 'read' ,
1873- expires : Date . now ( ) + 5 ,
1873+ expires : Date . now ( ) + 2000 ,
18741874 promptSaveAs : 'fname.ext'
18751875 } , function ( err , signedUrl ) {
18761876 assert ( signedUrl . indexOf ( disposition ) > - 1 ) ;
@@ -1884,7 +1884,7 @@ describe('File', function() {
18841884 var disposition = 'attachment; filename="fname.ext"' ;
18851885 directoryFile . getSignedUrl ( {
18861886 action : 'read' ,
1887- expires : Date . now ( ) + 5 ,
1887+ expires : Date . now ( ) + 2000 ,
18881888 responseDisposition : disposition
18891889 } , function ( err , signedUrl ) {
18901890 assert ( signedUrl . indexOf ( encodeURIComponent ( disposition ) ) > - 1 ) ;
@@ -1897,7 +1897,7 @@ describe('File', function() {
18971897 var saveAs = 'fname2.ext' ;
18981898 directoryFile . getSignedUrl ( {
18991899 action : 'read' ,
1900- expires : Date . now ( ) + 5 ,
1900+ expires : Date . now ( ) + 2000 ,
19011901 promptSaveAs : saveAs ,
19021902 responseDisposition : disposition
19031903 } , function ( err , signedUrl ) {
@@ -1973,7 +1973,7 @@ describe('File', function() {
19731973 'x-foo' : 'bar'
19741974 } ;
19751975
1976- var expires = Date . now ( ) + 5 ;
1976+ var expires = Date . now ( ) + 2000 ;
19771977 var expiresInSeconds = Math . round ( expires / 1000 ) ;
19781978 var name = encodeURIComponent ( directoryFile . name ) ;
19791979 var resource = '/' + directoryFile . bucket . name + '/' + name ;
0 commit comments