Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4842134

Browse filesBrowse files
author
anonx
committed
Fixed test file paths
1 parent 1e74f27 commit 4842134
Copy full SHA for 4842134

File tree

Expand file treeCollapse file tree

2 files changed

+18
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+18
-4
lines changed

‎samples/upload/tests/multipletest.go

Copy file name to clipboardExpand all lines: samples/upload/tests/multipletest.go
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@ package tests
22

33
import (
44
"net/url"
5+
"path"
56

67
"github.com/revel/revel/samples/upload/app/routes"
78

89
"github.com/revel/revel"
910
)
1011

12+
// MultipleTest is a test suite of Multiple controller.
1113
type MultipleTest struct {
1214
revel.TestSuite
1315
}
1416

17+
// TestThatMultipleFilesUploadWorks makes sure that Multiple.HandleUpload requires
18+
// multiple files to be uploaded.
1519
func (t *MultipleTest) TestThatMultipleFilesUploadWorks() {
1620
// Make sure it is not allowed to submit less than 2 files.
1721
t.PostFile(routes.Multiple.HandleUpload(), url.Values{}, url.Values{
1822
"file": {
19-
"github.com/revel/revel/samples/upload/public/img/favicon.png",
23+
path.Join(revel.BasePath, "public/img/favicon.png"),
2024
},
2125
})
2226
t.AssertOk()

‎samples/upload/tests/singletest.go

Copy file name to clipboardExpand all lines: samples/upload/tests/singletest.go
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ package tests
22

33
import (
44
"net/url"
5+
"path"
56

67
"github.com/revel/revel"
78
)
89

10+
// SingleTest is a test suite of Multiple controller.
911
type SingleTest struct {
1012
revel.TestSuite
1113
}
1214

15+
// TestThatSingleAvatarUploadWorks checks whether Signle.HandleUpload doesn't let users
16+
// upload anything but only image files of type JPG and PNG with a specific resolution and size.
1317
func (t *SingleTest) TestThatSingleAvatarUploadWorks() {
1418
// Make sure file is required.
1519
t.PostFile("/single/HandleUpload", url.Values{}, url.Values{
@@ -21,21 +25,27 @@ func (t *SingleTest) TestThatSingleAvatarUploadWorks() {
2125

2226
// Make sure incorrect format is not being accepted.
2327
t.PostFile("/single/HandleUpload", url.Values{}, url.Values{
24-
"avatar": {"github.com/revel/revel/samples/upload/public/css/bootstrap.css"},
28+
"avatar": {
29+
path.Join(revel.BasePath, "public/css/bootstrap.css"),
30+
},
2531
})
2632
t.AssertOk()
2733
t.AssertContains("Incorrect file format")
2834

2935
// Ensure low resolution avatar cannot be uploaded.
3036
t.PostFile("/single/HandleUpload", url.Values{}, url.Values{
31-
"avatar": {"github.com/revel/revel/samples/upload/public/img/favicon.png"},
37+
"avatar": {
38+
path.Join(revel.BasePath, "public/img/favicon.png"),
39+
},
3240
})
3341
t.AssertOk()
3442
t.AssertContains("Minimum allowed resolution is 150x150px")
3543

3644
// Check whether correct avatar is uploaded.
3745
t.PostFile("/single/HandleUpload", url.Values{}, url.Values{
38-
"avatar": {"github.com/revel/revel/samples/upload/public/img/glyphicons-halflings.png"},
46+
"avatar": {
47+
path.Join(revel.BasePath, "public/img/glyphicons-halflings.png"),
48+
},
3949
})
4050
t.AssertOk()
4151
t.AssertContains("image/png")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.