-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht_snap_upload_test.go
77 lines (70 loc) · 1.82 KB
/
t_snap_upload_test.go
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"path/filepath"
"testing"
"snapr/cli"
)
func Test3SnapUploadCommand(t *testing.T) {
// ensure the temp directory exists
_, testTempDir, err := ensureTestDir("test-3")
if err != nil {
t.Errorf("could not create test temp dir: %s", testTempDir)
}
// clean up on fail
defer cleanupTestDir(testTempDir)
// define the tests
tests := []snapTest{
{"dir & file & no cleanup", true,
&cli.SnapCmdOptions{
OutFile: "toUpload.jpg",
UploadAfterSuccess: true,
}},
{"dir & file & cleanup", true,
&cli.SnapCmdOptions{
OutFile: "toUploadAndRemove.jpg",
UploadAfterSuccess: true,
CleanupAfterUpload: true,
}},
{"dir & users", true,
&cli.SnapCmdOptions{
OutDirUsers: true,
UploadAfterSuccess: true,
}},
{"dir & extra dir & users", true,
&cli.SnapCmdOptions{
OutDirExtra: "extra",
OutDirUsers: true,
UploadAfterSuccess: true,
}},
{"dir & webcam image", true,
&cli.SnapCmdOptions{
UseCamera: true,
UploadAfterSuccess: true,
}},
{"dir & screenshot", true,
&cli.SnapCmdOptions{
UseScreenshot: true,
UploadAfterSuccess: true,
}},
{"dir & BOTH screenshot and webcam", true,
&cli.SnapCmdOptions{
UseScreenshot: true,
UseCamera: true,
UploadAfterSuccess: true,
}},
{"dir & BOTH screenshot and webcam & cleanup", true,
&cli.SnapCmdOptions{
UseScreenshot: true,
UseCamera: true,
UploadAfterSuccess: true,
CleanupAfterUpload: true,
}},
}
// tack on the out dir with descriptions
for _, test := range tests {
// set the output dir (was lazy)
test.cmdOpts.OutDir = filepath.Join(testTempDir, test.description)
}
// OutDir is set on all these programmatically (below)
testCommandSnap(t, testTempDir, tests)
}