forked from reanahub/reana-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshare_remove_test.go
More file actions
57 lines (51 loc) · 1.29 KB
/
Copy pathshare_remove_test.go
File metadata and controls
57 lines (51 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
This file is part of REANA.
Copyright (C) 2023, 2024, 2026 CERN.
REANA is free software; you can redistribute it and/or modify it under the terms
of the MIT License; see LICENSE file for more details.
*/
package cmd
import (
"fmt"
"net/http"
"testing"
)
var shareRemovePathTemplate = "/api/workflows/%s/unshare"
func TestShareRemove(t *testing.T) {
workflowName := "my_workflow"
tests := map[string]TestCmdParams{
"default": {
serverResponses: map[string]ServerResponse{
fmt.Sprintf(shareRemovePathTemplate, workflowName): {
statusCode: http.StatusOK,
},
},
args: []string{"-w", workflowName, "--user", "bob@cern.ch"},
expected: []string{
"my_workflow is no longer shared with bob@cern.ch",
},
},
"invalid workflow": {
serverResponses: map[string]ServerResponse{
fmt.Sprintf(shareRemovePathTemplate, "invalid"): {
statusCode: http.StatusNotFound,
responseFile: "common_invalid_workflow.json",
},
},
args: []string{
"-w", "invalid",
"--user", "bob@cern.ch",
},
expected: []string{
"REANA_WORKON is set to invalid, but that workflow does not exist.",
},
wantError: true,
},
}
for name, params := range tests {
t.Run(name, func(t *testing.T) {
params.cmd = "share-remove"
testCmdRun(t, params)
})
}
}