@@ -4,7 +4,6 @@ import path from 'path';
44import { setConfigFile } from '../../../src/config/file' ;
55
66import service from '../../../src/service/index' ;
7- import Proxy from '../../../src/proxy' ;
87import { Repo } from '../../../src/db/types' ;
98
109setConfigFile ( path . join ( process . cwd ( ) , 'test' , 'testCli.proxy.config.json' ) ) ;
@@ -120,7 +119,7 @@ describe('test git-proxy-cli', function () {
120119 const expectedMessages = null ;
121120 const expectedErrorMessages = [ `Error: Login '${ username } ': '401'` ] ;
122121 try {
123- await helper . startServer ( service as unknown as Proxy ) ;
122+ await helper . startServer ( service ) ;
124123 await helper . runCli ( cli , expectedExitCode , expectedMessages , expectedErrorMessages ) ;
125124 } finally {
126125 await helper . closeServer ( service . httpServer ) ;
@@ -135,7 +134,7 @@ describe('test git-proxy-cli', function () {
135134 const expectedMessages = [ `Login "${ username } " <admin@place.com> (admin): OK` ] ;
136135 const expectedErrorMessages = null ;
137136 try {
138- await helper . startServer ( service as unknown as Proxy ) ;
137+ await helper . startServer ( service ) ;
139138 await helper . runCli ( cli , expectedExitCode , expectedMessages , expectedErrorMessages ) ;
140139 } finally {
141140 await helper . closeServer ( service . httpServer ) ;
@@ -148,7 +147,7 @@ describe('test git-proxy-cli', function () {
148147 const expectedMessages = [ `Login "${ TEST_USER } " <${ TEST_EMAIL } >: OK` ] ;
149148 const expectedErrorMessages = null ;
150149 try {
151- await helper . startServer ( service as unknown as Proxy ) ;
150+ await helper . startServer ( service ) ;
152151 await helper . runCli ( cli , expectedExitCode , expectedMessages , expectedErrorMessages ) ;
153152 } finally {
154153 await helper . closeServer ( service . httpServer ) ;
@@ -171,7 +170,7 @@ describe('test git-proxy-cli', function () {
171170
172171 it ( 'logout should succeed when server is down (but logged in before)' , async function ( ) {
173172 try {
174- await helper . startServer ( service as unknown as Proxy ) ;
173+ await helper . startServer ( service ) ;
175174 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
176175 } finally {
177176 await helper . closeServer ( service . httpServer ) ;
@@ -192,7 +191,7 @@ describe('test git-proxy-cli', function () {
192191 const expectedExitCode = 0 ;
193192 const expectedMessages = [ `Logout: OK` ] ;
194193 const expectedErrorMessages = null ;
195- await helper . startServer ( service as unknown as Proxy ) ;
194+ await helper . startServer ( service ) ;
196195 await helper . runCli ( cli , expectedExitCode , expectedMessages , expectedErrorMessages ) ;
197196 } finally {
198197 await helper . closeServer ( service . httpServer ) ;
@@ -201,7 +200,7 @@ describe('test git-proxy-cli', function () {
201200
202201 it ( 'logout shoud be successful when authenticated (server is up)' , async function ( ) {
203202 try {
204- await helper . startServer ( service as unknown as Proxy ) ;
203+ await helper . startServer ( service ) ;
205204 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
206205
207206 const cli = `${ CLI_PATH } logout` ;
@@ -235,7 +234,7 @@ describe('test git-proxy-cli', function () {
235234 it ( 'attempt to authorise should fail when server is down' , async function ( ) {
236235 try {
237236 // start server -> login -> stop server
238- await helper . startServer ( service as unknown as Proxy ) ;
237+ await helper . startServer ( service ) ;
239238 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
240239 } finally {
241240 await helper . closeServer ( service . httpServer ) ;
@@ -263,7 +262,7 @@ describe('test git-proxy-cli', function () {
263262 it ( 'attempt to authorise should fail when not authenticated (server restarted)' , async function ( ) {
264263 try {
265264 await helper . createCookiesFileWithExpiredCookie ( ) ;
266- await helper . startServer ( service as unknown as Proxy ) ;
265+ await helper . startServer ( service ) ;
267266 const id = pushId ;
268267 const cli = `${ CLI_PATH } authorise --id ${ id } ` ;
269268 const expectedExitCode = 3 ;
@@ -277,7 +276,7 @@ describe('test git-proxy-cli', function () {
277276
278277 it ( 'attempt to authorise should fail when git push ID not found' , async function ( ) {
279278 try {
280- await helper . startServer ( service as unknown as Proxy ) ;
279+ await helper . startServer ( service ) ;
281280 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
282281
283282 const id = GHOST_PUSH_ID ;
@@ -312,7 +311,7 @@ describe('test git-proxy-cli', function () {
312311 it ( 'attempt to cancel should fail when server is down' , async function ( ) {
313312 try {
314313 // start server -> login -> stop server
315- await helper . startServer ( service as unknown as Proxy ) ;
314+ await helper . startServer ( service ) ;
316315 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
317316 } finally {
318317 await helper . closeServer ( service . httpServer ) ;
@@ -340,7 +339,7 @@ describe('test git-proxy-cli', function () {
340339 it ( 'attempt to cancel should fail when not authenticated (server restarted)' , async function ( ) {
341340 try {
342341 await helper . createCookiesFileWithExpiredCookie ( ) ;
343- await helper . startServer ( service as unknown as Proxy ) ;
342+ await helper . startServer ( service ) ;
344343 const id = pushId ;
345344 const cli = `${ CLI_PATH } cancel --id ${ id } ` ;
346345 const expectedExitCode = 3 ;
@@ -355,7 +354,7 @@ describe('test git-proxy-cli', function () {
355354
356355 it ( 'attempt to cancel should fail when git push ID not found' , async function ( ) {
357356 try {
358- await helper . startServer ( service as unknown as Proxy ) ;
357+ await helper . startServer ( service ) ;
359358 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
360359
361360 const id = GHOST_PUSH_ID ;
@@ -376,7 +375,7 @@ describe('test git-proxy-cli', function () {
376375 it ( 'attempt to ls should fail when server is down' , async function ( ) {
377376 try {
378377 // start server -> login -> stop server
379- await helper . startServer ( service as unknown as Proxy ) ;
378+ await helper . startServer ( service ) ;
380379 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
381380 } finally {
382381 await helper . closeServer ( service . httpServer ) ;
@@ -401,7 +400,7 @@ describe('test git-proxy-cli', function () {
401400
402401 it ( 'attempt to ls should fail when invalid option given' , async function ( ) {
403402 try {
404- await helper . startServer ( service as unknown as Proxy ) ;
403+ await helper . startServer ( service ) ;
405404 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
406405
407406 const cli = `${ CLI_PATH } ls --invalid` ;
@@ -435,7 +434,7 @@ describe('test git-proxy-cli', function () {
435434 it ( 'attempt to reject should fail when server is down' , async function ( ) {
436435 try {
437436 // start server -> login -> stop server
438- await helper . startServer ( service as unknown as Proxy ) ;
437+ await helper . startServer ( service ) ;
439438 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
440439 } finally {
441440 await helper . closeServer ( service . httpServer ) ;
@@ -463,7 +462,7 @@ describe('test git-proxy-cli', function () {
463462 it ( 'attempt to reject should fail when not authenticated (server restarted)' , async function ( ) {
464463 try {
465464 await helper . createCookiesFileWithExpiredCookie ( ) ;
466- await helper . startServer ( service as unknown as Proxy ) ;
465+ await helper . startServer ( service ) ;
467466 const id = pushId ;
468467 const cli = `${ CLI_PATH } reject --id ${ id } ` ;
469468 const expectedExitCode = 3 ;
@@ -477,7 +476,7 @@ describe('test git-proxy-cli', function () {
477476
478477 it ( 'attempt to reject should fail when git push ID not found' , async function ( ) {
479478 try {
480- await helper . startServer ( service as unknown as Proxy ) ;
479+ await helper . startServer ( service ) ;
481480 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
482481
483482 const id = GHOST_PUSH_ID ;
@@ -506,7 +505,7 @@ describe('test git-proxy-cli', function () {
506505 it ( 'attempt to create user should fail when server is down' , async function ( ) {
507506 try {
508507 // start server -> login -> stop server
509- await helper . startServer ( service as unknown as Proxy ) ;
508+ await helper . startServer ( service ) ;
510509 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
511510 } finally {
512511 await helper . closeServer ( service . httpServer ) ;
@@ -531,7 +530,7 @@ describe('test git-proxy-cli', function () {
531530
532531 it ( 'attempt to create user should fail when not admin' , async function ( ) {
533532 try {
534- await helper . startServer ( service as unknown as Proxy ) ;
533+ await helper . startServer ( service ) ;
535534 await helper . runCli ( `${ CLI_PATH } login --username testuser --password testpassword` ) ;
536535
537536 const cli = `${ CLI_PATH } create-user --username newuser --password newpass --email new@email.com --gitAccount newgit` ;
@@ -546,7 +545,7 @@ describe('test git-proxy-cli', function () {
546545
547546 it ( 'attempt to create user should fail with missing required fields' , async function ( ) {
548547 try {
549- await helper . startServer ( service as unknown as Proxy ) ;
548+ await helper . startServer ( service ) ;
550549 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
551550
552551 const cli = `${ CLI_PATH } create-user --username newuser --password "" --email new@email.com --gitAccount newgit` ;
@@ -562,7 +561,7 @@ describe('test git-proxy-cli', function () {
562561 it ( 'should successfully create a new user' , async function ( ) {
563562 const uniqueUsername = `newuser_${ Date . now ( ) } ` ;
564563 try {
565- await helper . startServer ( service as unknown as Proxy ) ;
564+ await helper . startServer ( service ) ;
566565 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
567566
568567 const cli = `${ CLI_PATH } create-user --username ${ uniqueUsername } --password newpass --email ${ uniqueUsername } @email.com --gitAccount newgit` ;
@@ -592,7 +591,7 @@ describe('test git-proxy-cli', function () {
592591 it ( 'should successfully create a new admin user' , async function ( ) {
593592 const uniqueUsername = `newadmin_${ Date . now ( ) } ` ;
594593 try {
595- await helper . startServer ( service as unknown as Proxy ) ;
594+ await helper . startServer ( service ) ;
596595 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
597596
598597 const cli = `${ CLI_PATH } create-user --username ${ uniqueUsername } --password newpass --email ${ uniqueUsername } @email.com --gitAccount newgit --admin` ;
@@ -639,7 +638,7 @@ describe('test git-proxy-cli', function () {
639638
640639 it ( 'attempt to ls should list existing push' , async function ( ) {
641640 try {
642- await helper . startServer ( service as unknown as Proxy ) ;
641+ await helper . startServer ( service ) ;
643642 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
644643
645644 const cli = `${ CLI_PATH } ls --authorised false --blocked true --canceled false --rejected false` ;
@@ -662,7 +661,7 @@ describe('test git-proxy-cli', function () {
662661
663662 it ( 'attempt to ls should not list existing push when filtered for authorised' , async function ( ) {
664663 try {
665- await helper . startServer ( service as unknown as Proxy ) ;
664+ await helper . startServer ( service ) ;
666665 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
667666
668667 const cli = `${ CLI_PATH } ls --authorised true` ;
@@ -677,7 +676,7 @@ describe('test git-proxy-cli', function () {
677676
678677 it ( 'attempt to ls should not list existing push when filtered for canceled' , async function ( ) {
679678 try {
680- await helper . startServer ( service as unknown as Proxy ) ;
679+ await helper . startServer ( service ) ;
681680 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
682681
683682 const cli = `${ CLI_PATH } ls --canceled true` ;
@@ -692,7 +691,7 @@ describe('test git-proxy-cli', function () {
692691
693692 it ( 'attempt to ls should not list existing push when filtered for rejected' , async function ( ) {
694693 try {
695- await helper . startServer ( service as unknown as Proxy ) ;
694+ await helper . startServer ( service ) ;
696695 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
697696
698697 const cli = `${ CLI_PATH } ls --rejected true` ;
@@ -707,7 +706,7 @@ describe('test git-proxy-cli', function () {
707706
708707 it ( 'attempt to ls should not list existing push when filtered for non-blocked' , async function ( ) {
709708 try {
710- await helper . startServer ( service as unknown as Proxy ) ;
709+ await helper . startServer ( service ) ;
711710 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
712711
713712 const cli = `${ CLI_PATH } ls --blocked false` ;
@@ -722,7 +721,7 @@ describe('test git-proxy-cli', function () {
722721
723722 it ( 'authorise push and test if appears on authorised list' , async function ( ) {
724723 try {
725- await helper . startServer ( service as unknown as Proxy ) ;
724+ await helper . startServer ( service ) ;
726725 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
727726
728727 let cli = `${ CLI_PATH } ls --authorised true --canceled false --rejected false` ;
@@ -749,7 +748,7 @@ describe('test git-proxy-cli', function () {
749748
750749 it ( 'reject push and test if appears on rejected list' , async function ( ) {
751750 try {
752- await helper . startServer ( service as unknown as Proxy ) ;
751+ await helper . startServer ( service ) ;
753752 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
754753
755754 let cli = `${ CLI_PATH } ls --authorised false --canceled false --rejected true` ;
@@ -776,7 +775,7 @@ describe('test git-proxy-cli', function () {
776775
777776 it ( 'cancel push and test if appears on canceled list' , async function ( ) {
778777 try {
779- await helper . startServer ( service as unknown as Proxy ) ;
778+ await helper . startServer ( service ) ;
780779 await helper . runCli ( `${ CLI_PATH } login --username admin --password admin` ) ;
781780
782781 let cli = `${ CLI_PATH } ls --authorised false --canceled true --rejected false` ;
0 commit comments