Skip to content
Browse files

#14 - added integration test to confirm that the column size is

adequate. A new test file is also added, which has been fairly carefully
anonymised.
  • Loading branch information...
1 parent c5ce4d3 commit 05055ca40a5e46248079826340ed332260b1c72c stuart committed Apr 19, 2012
View
14 grails-app/conf/Config.groovy
@@ -110,14 +110,14 @@ grails.plugins.springsecurity.authority.className = 'uk.org.openmentor.auth.Role
// Added for the Spring Security LDAP plugin:
//grails.plugins.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
//grails.plugins.springsecurity.ldap.context.managerPassword = 'secret'
-grails.plugins.springsecurity.ldap.context.anonymousReadOnly=true
-grails.plugins.springsecurity.ldap.context.server = 'ldap://localhost:1389/'
-grails.plugins.springsecurity.ldap.search.base = 'dc=example,dc=com'
-grails.plugins.springsecurity.ldap.search.filter = '(uid={0})'
-grails.plugins.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=example,dc=com'
-grails.plugins.springsecurity.ldap.authorities.groupSearchFilter = 'uniqueMember={0}'
+//grails.plugins.springsecurity.ldap.context.anonymousReadOnly=true
+//grails.plugins.springsecurity.ldap.context.server = 'ldap://localhost:1389/'
+//grails.plugins.springsecurity.ldap.search.base = 'dc=example,dc=com'
+//grails.plugins.springsecurity.ldap.search.filter = '(uid={0})'
+//grails.plugins.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=example,dc=com'
+//grails.plugins.springsecurity.ldap.authorities.groupSearchFilter = 'uniqueMember={0}'
//grails.plugins.springsecurity.password.algorithm = 'SHA-256'
-grails.plugins.springsecurity.ldap.authorities.retrieveDatabaseRoles = true
+//grails.plugins.springsecurity.ldap.authorities.retrieveDatabaseRoles = true
// This exploits the significantly more flexible handling of types in Grails to
// allow configuration down to the grading scheme.
View
2 grails-app/domain/uk/org/openmentor/data/Assignment.groovy
@@ -6,7 +6,7 @@ class Assignment {
String code
String title
- static hasMany = [ submission: Submission ]
+ static hasMany = [ submissions: Submission ]
static constraints = {
courseId(nullable: false, blank: false)
View
2 grails-app/domain/uk/org/openmentor/data/Submission.groovy
@@ -33,7 +33,7 @@ class Submission {
static constraints = {
filename(nullable: false)
grade(nullable: false)
- fileContents(nullable: true)
+ fileContents(nullable: true, maxSize: 8*1024*1024) // Allow up to 8Mb
dateSubmitted(nullable: false)
}
View
35 test/integration/uk/org/openmentor/data/SubmissionIntegrationTests.groovy
@@ -0,0 +1,35 @@
+package uk.org.openmentor.data
+
+import grails.test.*
+import groovy.util.GroovyTestCase;
+import uk.org.openmentor.data.Assignment
+
+class SubmissionIntegrationTests extends GroovyTestCase {
+ protected void setUp() {
+ super.setUp()
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+ /**
+ * Simple check we can write a submission record the test data
+ */
+ void testStoreSubmission() {
+ def assignment = Assignment.findByCode("TMA03")
+ assertTrue assignment != null
+
+ def testFileName = 'test/resources/test1a.doc'
+ def testFile = new File(testFileName)
+
+ // Write the submission
+ def submission = new Submission(filename: "foo.doc", grade: "A", fileContents: testFile.getBytes())
+ assignment.addToSubmissions(submission)
+ assignment.save(validate: true, flush: true)
+
+ // And now look for it - confirming it really was written
+ def found = Submission.findByFilename("foo.doc")
+ assertTrue found != null
+ }
+}
View
BIN test/resources/test1a.doc
Binary file not shown.
View
17 test/unit/uk/org/openmentor/data/SubmissionTests.groovy
@@ -1,17 +0,0 @@
-package uk.org.openmentor.data
-
-import grails.test.*
-
-class SubmissionTests extends GrailsUnitTestCase {
- protected void setUp() {
- super.setUp()
- }
-
- protected void tearDown() {
- super.tearDown()
- }
-
- void testSomething() {
-
- }
-}

0 comments on commit 05055ca

Please sign in to comment.
Something went wrong with that request. Please try again.