@@ -79,7 +79,7 @@ const decoratePipelineMock = pipeline => {
79
79
const mock = hoek . clone ( pipeline ) ;
80
80
81
81
mock . sync = sinon . stub ( ) ;
82
- mock . addWebhook = sinon . stub ( ) ;
82
+ mock . addWebhooks = sinon . stub ( ) ;
83
83
mock . syncPRs = sinon . stub ( ) ;
84
84
mock . update = sinon . stub ( ) ;
85
85
mock . toJson = sinon . stub ( ) . returns ( pipeline ) ;
@@ -1304,7 +1304,7 @@ describe('pipeline plugin test', () => {
1304
1304
} ) ;
1305
1305
1306
1306
it ( 'returns 500 when model returns an error' , ( ) => {
1307
- pipelineMock . addWebhook . rejects ( new Error ( 'icantdothatdave' ) ) ;
1307
+ pipelineMock . addWebhooks . rejects ( new Error ( 'icantdothatdave' ) ) ;
1308
1308
1309
1309
return server . inject ( options ) . then ( reply => {
1310
1310
assert . equal ( reply . statusCode , 500 ) ;
@@ -1436,7 +1436,7 @@ describe('pipeline plugin test', () => {
1436
1436
1437
1437
pipelineMock = getPipelineMocks ( testPipeline ) ;
1438
1438
pipelineMock . sync . resolves ( pipelineMock ) ;
1439
- pipelineMock . addWebhook . resolves ( null ) ;
1439
+ pipelineMock . addWebhooks . resolves ( null ) ;
1440
1440
1441
1441
pipelineFactoryMock . get . resolves ( null ) ;
1442
1442
pipelineFactoryMock . create . resolves ( pipelineMock ) ;
@@ -1653,7 +1653,7 @@ describe('pipeline plugin test', () => {
1653
1653
} )
1654
1654
. resolves ( [ getCollectionMock ( testDefaultCollection ) ] ) ;
1655
1655
1656
- pipelineMock . addWebhook . rejects ( testError ) ;
1656
+ pipelineMock . addWebhooks . rejects ( testError ) ;
1657
1657
1658
1658
return server . inject ( options ) . then ( reply => {
1659
1659
assert . equal ( reply . statusCode , 500 ) ;
@@ -1704,7 +1704,7 @@ describe('pipeline plugin test', () => {
1704
1704
1705
1705
pipelineMock = getPipelineMocks ( testPipeline ) ;
1706
1706
updatedPipelineMock = hoek . clone ( pipelineMock ) ;
1707
- updatedPipelineMock . addWebhook . resolves ( null ) ;
1707
+ updatedPipelineMock . addWebhooks . resolves ( null ) ;
1708
1708
1709
1709
pipelineFactoryMock . get . withArgs ( { id } ) . resolves ( pipelineMock ) ;
1710
1710
pipelineFactoryMock . get . withArgs ( { scmUri } ) . resolves ( null ) ;
@@ -1719,7 +1719,7 @@ describe('pipeline plugin test', () => {
1719
1719
it ( 'returns 200 and correct pipeline data' , ( ) =>
1720
1720
server . inject ( options ) . then ( reply => {
1721
1721
assert . calledOnce ( pipelineMock . update ) ;
1722
- assert . calledOnce ( updatedPipelineMock . addWebhook ) ;
1722
+ assert . calledOnce ( updatedPipelineMock . addWebhooks ) ;
1723
1723
assert . equal ( reply . statusCode , 200 ) ;
1724
1724
} ) ) ;
1725
1725
@@ -1733,7 +1733,7 @@ describe('pipeline plugin test', () => {
1733
1733
1734
1734
return server . inject ( options ) . then ( reply => {
1735
1735
assert . calledOnce ( pipelineMock . update ) ;
1736
- assert . calledOnce ( updatedPipelineMock . addWebhook ) ;
1736
+ assert . calledOnce ( updatedPipelineMock . addWebhooks ) ;
1737
1737
assert . equal ( reply . statusCode , 200 ) ;
1738
1738
} ) ;
1739
1739
} ) ;
@@ -1790,7 +1790,7 @@ describe('pipeline plugin test', () => {
1790
1790
pipelineFactoryMock . get . withArgs ( { id } ) . resolves ( null ) ;
1791
1791
1792
1792
return server . inject ( options ) . then ( reply => {
1793
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1793
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1794
1794
assert . equal ( reply . statusCode , 404 ) ;
1795
1795
} ) ;
1796
1796
} ) ;
@@ -1799,7 +1799,7 @@ describe('pipeline plugin test', () => {
1799
1799
pipelineMock . configPipelineId = 123 ;
1800
1800
1801
1801
return server . inject ( options ) . then ( reply => {
1802
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1802
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1803
1803
assert . equal ( reply . statusCode , 403 ) ;
1804
1804
} ) ;
1805
1805
} ) ;
@@ -1808,7 +1808,7 @@ describe('pipeline plugin test', () => {
1808
1808
userMock . getPermissions . withArgs ( scmUri ) . resolves ( { admin : false } ) ;
1809
1809
1810
1810
return server . inject ( options ) . then ( reply => {
1811
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1811
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1812
1812
assert . equal ( reply . statusCode , 403 ) ;
1813
1813
} ) ;
1814
1814
} ) ;
@@ -1817,7 +1817,7 @@ describe('pipeline plugin test', () => {
1817
1817
userMock . getPermissions . withArgs ( oldScmUri ) . resolves ( { admin : false } ) ;
1818
1818
1819
1819
return server . inject ( options ) . then ( reply => {
1820
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1820
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1821
1821
assert . equal ( reply . statusCode , 403 ) ;
1822
1822
} ) ;
1823
1823
} ) ;
@@ -1830,7 +1830,7 @@ describe('pipeline plugin test', () => {
1830
1830
// Only call once to get permissions on the new repo
1831
1831
assert . calledOnce ( userMock . getPermissions ) ;
1832
1832
assert . calledWith ( userMock . getPermissions , scmUri ) ;
1833
- assert . calledOnce ( updatedPipelineMock . addWebhook ) ;
1833
+ assert . calledOnce ( updatedPipelineMock . addWebhooks ) ;
1834
1834
assert . equal ( reply . statusCode , 200 ) ;
1835
1835
} ) ;
1836
1836
} ) ;
@@ -1843,7 +1843,7 @@ describe('pipeline plugin test', () => {
1843
1843
// Only call once to get permissions on the new repo
1844
1844
assert . calledOnce ( userMock . getPermissions ) ;
1845
1845
assert . calledWith ( userMock . getPermissions , scmUri ) ;
1846
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1846
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1847
1847
assert . equal ( reply . statusCode , 403 ) ;
1848
1848
} ) ;
1849
1849
} ) ;
@@ -1857,7 +1857,7 @@ describe('pipeline plugin test', () => {
1857
1857
} ;
1858
1858
1859
1859
return server . inject ( options ) . then ( reply => {
1860
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1860
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1861
1861
assert . equal ( reply . statusCode , 401 ) ;
1862
1862
} ) ;
1863
1863
} ) ;
@@ -1867,7 +1867,7 @@ describe('pipeline plugin test', () => {
1867
1867
1868
1868
return server . inject ( options ) . then ( reply => {
1869
1869
assert . equal ( reply . statusCode , 409 ) ;
1870
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1870
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1871
1871
assert . strictEqual ( reply . result . message , `Pipeline already exists with the ID: ${ pipelineMock . id } ` ) ;
1872
1872
} ) ;
1873
1873
} ) ;
@@ -1878,7 +1878,7 @@ describe('pipeline plugin test', () => {
1878
1878
pipelineFactoryMock . get . withArgs ( { id } ) . rejects ( testError ) ;
1879
1879
1880
1880
return server . inject ( options ) . then ( reply => {
1881
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1881
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1882
1882
assert . equal ( reply . statusCode , 500 ) ;
1883
1883
} ) ;
1884
1884
} ) ;
@@ -1889,7 +1889,7 @@ describe('pipeline plugin test', () => {
1889
1889
pipelineMock . update . rejects ( testError ) ;
1890
1890
1891
1891
return server . inject ( options ) . then ( reply => {
1892
- assert . notCalled ( updatedPipelineMock . addWebhook ) ;
1892
+ assert . notCalled ( updatedPipelineMock . addWebhooks ) ;
1893
1893
assert . equal ( reply . statusCode , 500 ) ;
1894
1894
} ) ;
1895
1895
} ) ;
@@ -1900,18 +1900,18 @@ describe('pipeline plugin test', () => {
1900
1900
pipelineMock . sync . rejects ( testError ) ;
1901
1901
1902
1902
return server . inject ( options ) . then ( reply => {
1903
- assert . calledOnce ( updatedPipelineMock . addWebhook ) ;
1903
+ assert . calledOnce ( updatedPipelineMock . addWebhooks ) ;
1904
1904
assert . equal ( reply . statusCode , 500 ) ;
1905
1905
} ) ;
1906
1906
} ) ;
1907
1907
1908
1908
it ( 'returns 500 when the pipeline model fails to add webhooks during create' , ( ) => {
1909
1909
const testError = new Error ( 'pipelineModelAddWebhookError' ) ;
1910
1910
1911
- updatedPipelineMock . addWebhook . rejects ( testError ) ;
1911
+ updatedPipelineMock . addWebhooks . rejects ( testError ) ;
1912
1912
1913
1913
return server . inject ( options ) . then ( reply => {
1914
- assert . calledOnce ( updatedPipelineMock . addWebhook ) ;
1914
+ assert . calledOnce ( updatedPipelineMock . addWebhooks ) ;
1915
1915
assert . equal ( reply . statusCode , 500 ) ;
1916
1916
} ) ;
1917
1917
} ) ;
0 commit comments