forked from grails-file-uploader/grails-file-uploader
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in makepublic-fix (pull request #6)
Filegroup makepublic fixes and test case.
- Loading branch information
Showing
4 changed files
with
77 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2011, CauseCode Technologies Pvt Ltd, India. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are not permitted. | ||
*/ | ||
|
||
import com.lucastex.grails.fileuploader.CDNProvider | ||
import com.lucastex.grails.fileuploader.util.Time | ||
|
||
fileuploader { | ||
AmazonKey = "RANDOM_KEY" | ||
AmazonSecret = "RANDOM_SECRET" | ||
persistence.provider = "mongodb" | ||
user { | ||
maxSize = 1024 * 1024 * 2 // 2 MB | ||
allowedExtensions = ["jpg","jpeg","gif","png"] | ||
storageTypes = "CDN" | ||
container = "causecode-1" | ||
provider = CDNProvider.AMAZON | ||
makePublic = true | ||
} | ||
image { | ||
maxSize = 1024 * 1024 * 2 // 2 MB | ||
allowedExtensions = ["jpg","jpeg","gif","png"] | ||
storageTypes = "CDN" | ||
container = "causecode-1" | ||
provider = CDNProvider.AMAZON | ||
expirationPeriod = Time.DAY * 365 | ||
} | ||
profile { | ||
maxSize = 1024 * 1024 * 2 // 2 MB | ||
allowedExtensions = ["jpg","jpeg","gif","png"] | ||
storageTypes = "CDN" | ||
container = "causecode-1" | ||
provider = CDNProvider.AMAZON | ||
expirationPeriod = Time.DAY * 365 | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
test/unit/com/lucastex/grails/fileuploader/FileUploaderServiceSpec.groovy
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,30 @@ | ||
/* | ||
* Copyright (c) 2011, CauseCode Technologies Pvt Ltd, India. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are not permitted. | ||
*/ | ||
|
||
package com.lucastex.grails.fileuploader | ||
|
||
import grails.test.mixin.TestFor | ||
import grails.test.mixin.TestMixin | ||
import grails.test.mixin.support.GrailsUnitTestMixin | ||
import org.codehaus.groovy.grails.plugins.codecs.HTMLCodec | ||
import spock.lang.Specification | ||
|
||
@TestFor(FileUploaderService) | ||
@TestMixin(GrailsUnitTestMixin) | ||
class FileUploaderServiceSpec extends Specification { | ||
|
||
void "test isPublicGroup for various file groups"() { | ||
mockCodec(HTMLCodec) | ||
|
||
expect: "Following conditions should pass" | ||
service.isPublicGroup("user") == true | ||
service.isPublicGroup("image") == false | ||
service.isPublicGroup("profile") == false | ||
service.isPublicGroup() == false | ||
} | ||
} |