-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from trgeiger/next
Merge next
- Loading branch information
Showing
31 changed files
with
1,050 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
copr-cli | ||
copr-tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Test", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
"program": "${workspaceFolder}/cmd", | ||
"args": [ | ||
"" | ||
] | ||
}, | ||
{ | ||
"name": "List", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": ["list"] | ||
}, | ||
{ | ||
"name": "Prune", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": ["prune"] | ||
}, | ||
{ | ||
"name": "Enable", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": ["enable", "kylegospo/bazzite"] | ||
}, | ||
{ | ||
"name": "Disable", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": ["disable", "kylegospo/bazzite"] | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"go.testFlags": [ | ||
"-v", | ||
"-coverpkg=all" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/trgeiger/copr-tool/internal/testutil" | ||
) | ||
|
||
func TestDisableCmd(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
args []string | ||
repoFiles [][]string // format: file/reponame, test directory folder | ||
otherFiles [][]string // format: filename, path, test directory folder | ||
expected string | ||
}{ | ||
{ | ||
name: "Disable invalid repo name", | ||
args: []string{ | ||
"copr-tool", | ||
}, | ||
expected: "invalid repository name: copr-tool\n", | ||
}, | ||
{ | ||
name: "Repo does not exist", | ||
args: []string{ | ||
"example/example", | ||
}, | ||
expected: "repository example/example is not installed\n", | ||
}, | ||
{ | ||
name: "Repo already exists and already disabled", | ||
args: []string{ | ||
"kylegospo/bazzite", | ||
}, | ||
repoFiles: [][]string{ | ||
{"_copr:copr.fedorainfracloud.org:kylegospo:bazzite.repo", "disabled"}, | ||
}, | ||
expected: "Repository kylegospo/bazzite is already disabled.\n", | ||
}, | ||
{ | ||
name: "Repo already exists but not disabled", | ||
args: []string{ | ||
"kylegospo/bazzite", | ||
}, | ||
repoFiles: [][]string{ | ||
{"_copr:copr.fedorainfracloud.org:kylegospo:bazzite.repo", "enabled"}, | ||
}, | ||
expected: "Repository kylegospo/bazzite disabled.\n", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
|
||
b := new(bytes.Buffer) | ||
fs := testutil.AssembleTestFs(test.repoFiles, test.otherFiles) | ||
cmd := NewDisableCmd(fs, b) | ||
cmd.SetOut(b) | ||
cmd.SetArgs(test.args) | ||
|
||
cmd.Execute() | ||
|
||
if b.String() != test.expected { | ||
t.Fatalf("Test \"%s\" failed", test.name) | ||
} | ||
} | ||
} |
Oops, something went wrong.