From 802b2586457b0c30ddf08c42e69f7ce919f892e7 Mon Sep 17 00:00:00 2001 From: bozd4g Date: Sat, 23 May 2020 00:05:53 +0300 Subject: [PATCH 1/2] Add cli tests for repository command --- .DS_Store | Bin 8196 -> 8196 bytes cmd/repository_command_test.go | 136 +++++++++++++++++++++++++++++++++ go.sum | 9 +++ 3 files changed, 145 insertions(+) create mode 100644 cmd/repository_command_test.go diff --git a/.DS_Store b/.DS_Store index 9df718e30cf46258ff4a23cc0ae0833581ec4af6..c70190bbe8baa5c1408f6cb342ceb06230723ed7 100644 GIT binary patch delta 33 pcmZp1XmOa}¥U^hRb!ekzS>doweXPGyL@N8z@%r5bl9RRtE3fTYv delta 164 zcmZp1XmOa}C7U^hRb%48ma>UvfNJ%&t%6oyoW#GG`);N<+=0tPV9d<3MBWOMUf zT#|C~lYpWeEpFCXvs4c`qN_+DprRlH*#?kBo7)7=F>k&rqs~0BfM+wi#9wv*#TF Date: Mon, 25 May 2020 20:30:40 +0300 Subject: [PATCH 2/2] Edit test file for log.Fatal to t.Errorf and remove DS_Store files. --- .DS_Store | Bin 8196 -> 0 bytes cmd/repository_command_test.go | 13 ++++++------- settings/.DS_Store | Bin 6148 -> 0 bytes 3 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 .DS_Store delete mode 100644 settings/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c70190bbe8baa5c1408f6cb342ceb06230723ed7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMzi$&U6n@S{^i(R5v7;qG>QEtN>cDcX0y9!4n4k?xf86yVnhGQsZeoQ66(JV3 z{uK<}Sos4O5d%m}Wnkg6-&11W^|H|-@m!t1li#zy?>;-{I3*&paWw1`EfZ0S%VF;- zs&k5qyQ@(;(qe%I{V5;yH@C}T+{n}hbwC|Z2h;&|Kpps39KfFKO4_pTb5v_}Kpprm z9dPdli_2jqSTXun2P%IA0Cv&r3+{XF251E{!HN+P6vJJC+||et!*F-BTgl4=D@N{4 zMh+iFn2nrJjAzIA)~A!n7`0Xh)Pbf07EN8cMI+j!NqBxYXD{xDv7#Idw(@cdZRzLd zC(qv9JYA3D!@2SC&g{2=&SHhGbcG(#A^slIgbqV)O48f)c*y_Y*T*-b8=gNJqbO$@ z+Hyi2l=!zrLfcf(Fj7Ev4GJU@a_@b6d-jT-eHxvyHlq=re~r=t_)0Jqc>aSrZ?Xa2 zT1LqKb!qMQb>?qm&2+S9#d`enFVGI=Ag3|vC$*WN^%Jir$_VwGzI=ZqYoRtyI2-L* zv7Rx=ur3PtGxVC`bwS;q^?0b|%hTijHTEVNBUI9s6YIF=bfmI2C-`g};1g2QGWu{{ zPN-*Pf4Wv0V}+XL<;A*Qv#treDKK9-RuJyvm3#Mx*Hz02b$$AtugaXIu75aIsB2zc ztjqi5v|)Sh30lESuwvv5T=#$Hh8A_;@*GH*dfA=-@3jB^e|Z9xSshRZ{<;IEJJ=k! zubsR#H~BhfvbY}Na>eCUjJ^vhm*U#}aU3}Phav8*#4^E(5fK#qBH(S%N*%aR2mS!K CAPt59 diff --git a/cmd/repository_command_test.go b/cmd/repository_command_test.go index e64d028..9824d20 100644 --- a/cmd/repository_command_test.go +++ b/cmd/repository_command_test.go @@ -2,7 +2,6 @@ package cmd import ( "bytes" - "log" "os/exec" "strings" "testing" @@ -19,7 +18,7 @@ func TestAddCommand_WhenRunsWithEmptyArgs_ReturnsOutput(t *testing.T) { out, err := cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } want := "You must specify a repository to clone" @@ -53,7 +52,7 @@ func TestAddCommand_WhenRunsWithCorrectArgs_ReturnsOutput(t *testing.T) { out, err := cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } want := "successfully added your repository to config file" @@ -86,7 +85,7 @@ func TestRemoveCommand_WhenRunsWithCorrectArg_ReturnsOutput(t *testing.T) { out, err := cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } cmd = exec.Command("go", "run", "../main.go", "remove", @@ -94,7 +93,7 @@ func TestRemoveCommand_WhenRunsWithCorrectArg_ReturnsOutput(t *testing.T) { out, err = cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } want := "successfully removed four-key repository from the config file" @@ -110,7 +109,7 @@ func TestRemoveCommand_WhenRunsWithDoesNotExistRepository_ReturnsOutput(t *testi out, err := cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } want := "The four-key repository does not exist!" @@ -125,7 +124,7 @@ func TestListCommand_WhenRunsCorrectly_ReturnsOutput(t *testing.T) { out, err := cmd.Output() if err != nil { - log.Fatal(err) + t.Errorf(err.Error()) } want := "repository/repositories has been found" diff --git a/settings/.DS_Store b/settings/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0