Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
burtbeckwith committed May 6, 2016
1 parent f69b5d8 commit 57369b8
Show file tree
Hide file tree
Showing 33 changed files with 106 additions and 179 deletions.
5 changes: 1 addition & 4 deletions functional-test-app/gradle/buildscript.inc
@@ -1,13 +1,10 @@
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0'
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.8.2'
}
}
Expand Up @@ -5,7 +5,6 @@ import pages.IndexPage
class DisableSpec extends AbstractHyphenatedSecuritySpec {

void 'lock account'() {

given:
String username = 'admin'

Expand Down Expand Up @@ -48,7 +47,6 @@ class DisableSpec extends AbstractHyphenatedSecuritySpec {
}

void 'disable account'() {

given:
String username = 'admin'

Expand Down Expand Up @@ -91,7 +89,6 @@ class DisableSpec extends AbstractHyphenatedSecuritySpec {
}

void 'expire account'() {

given:
String username = 'admin'

Expand Down Expand Up @@ -134,7 +131,6 @@ class DisableSpec extends AbstractHyphenatedSecuritySpec {
}

void 'expire password'() {

given:
String username = 'admin'

Expand Down
Expand Up @@ -5,7 +5,6 @@ import pages.IndexPage
class MiscSpec extends AbstractHyphenatedSecuritySpec {

void 'salted password'() {

given:
String username = 'testuser_books_and_movies'
def passwordEncoder = createSha256Encoder()
Expand All @@ -21,7 +20,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'switch user'() {

when:
login 'admin'

Expand Down Expand Up @@ -102,7 +100,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'hierarchical roles'() {

when:
login 'admin'

Expand Down Expand Up @@ -132,7 +129,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'taglibs unauthenticated'() {

when:
go 'tag-lib-test/test'

Expand Down Expand Up @@ -167,7 +163,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'taglibs user'() {

when:
login 'testuser'

Expand Down Expand Up @@ -207,7 +202,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'taglibs admin'() {

when:
login 'admin'

Expand Down Expand Up @@ -249,7 +243,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'metaclass methods unauthenticated'() {

when:
go 'tag-lib-test/testMetaclassMethods'

Expand All @@ -264,7 +257,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'metaclass methods authenticated'() {

when:
login 'admin'

Expand All @@ -285,7 +277,6 @@ class MiscSpec extends AbstractHyphenatedSecuritySpec {
}

void 'test hyphenated'() {

when:
go 'foo-bar'

Expand Down
Expand Up @@ -127,13 +127,12 @@ class RequestmapSecuritySpec extends AbstractSecuritySpec {
}

void 'create requestMaps'() {

when:
go 'testRequestmap/list?max=100'

then:
at ListRequestmapPage
def initialSize = requestmapRows.size()
int initialSize = requestmapRows.size()
initialSize == 20

when:
Expand Down Expand Up @@ -201,7 +200,6 @@ class RequestmapSecuritySpec extends AbstractSecuritySpec {
}

void 'secured urls not visible without login'() {

when:
go 'secure'

Expand All @@ -228,7 +226,6 @@ class RequestmapSecuritySpec extends AbstractSecuritySpec {
}

void 'check allowed for admin1'() {

when:
login 'admin1', 'password1'

Expand All @@ -251,7 +248,6 @@ class RequestmapSecuritySpec extends AbstractSecuritySpec {
}

void 'check allowed for user1'() {

when:
login 'user1', 'p4ssw0rd'

Expand Down
Expand Up @@ -110,7 +110,6 @@ class StaticSecuritySpec extends AbstractSecuritySpec {
}

void 'secured urls not visible without login'() {

when:
go 'secureAnnotated'

Expand Down
3 changes: 0 additions & 3 deletions integration-test-app/build.gradle
@@ -1,7 +1,4 @@
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url 'https://repo.grails.org/grails/core' }
Expand Down
Expand Up @@ -14,10 +14,10 @@
*/
package grails.plugin.springsecurity

import org.springframework.transaction.annotation.Transactional

import grails.core.GrailsApplication
import grails.test.mixin.integration.Integration
import grails.transaction.Rollback
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
import test.TestRole

Expand All @@ -29,16 +29,10 @@ import test.TestRole
@Transactional
abstract class AbstractIntegrationSpec extends Specification {

def grailsApplication

protected save(o, boolean flush = false) {
o.save(failOnError: true, flush: flush)
}
GrailsApplication grailsApplication

protected void flush() {
TestRole.withSession { session ->
session.flush()
}
protected <T> T save(T t) {
t.save(failOnError: true)
}

protected void flushAndClear() {
Expand Down
Expand Up @@ -14,24 +14,21 @@
*/
package grails.plugin.springsecurity

import com.test.AdditionalLogoutHandler
import grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
import org.springframework.mock.web.MockFilterChain
import org.springframework.mock.web.MockHttpServletRequest
import org.springframework.mock.web.MockHttpServletResponse
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler
import org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices

import com.test.AdditionalLogoutHandler

import grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter

/**
* @author <a href='mailto:george@georgemcintosh.com'>George McIntosh</a>
* @author <a href='mailto:burt@burtbeckwith.com'>Burt Beckwith</a>
*/
class AdditionalLogoutFiltersConfiguredSpec extends AbstractIntegrationSpec {

void 'additional handlers exist'() {

when:
MutableLogoutFilter logoutFilter = grailsApplication.mainContext.logoutFilter

Expand All @@ -47,7 +44,6 @@ class AdditionalLogoutFiltersConfiguredSpec extends AbstractIntegrationSpec {
}

void 'invoke'() {

when:
MutableLogoutFilter logoutFilter = grailsApplication.mainContext.logoutFilter
AdditionalLogoutHandler additionalLogoutHandler = grailsApplication.mainContext.additionalLogoutHandler
Expand Down
Expand Up @@ -14,10 +14,10 @@
*/
package grails.plugin.springsecurity

import static org.springframework.security.authentication.dao.DaoAuthenticationProvider.USER_NOT_FOUND_PASSWORD

import grails.plugin.springsecurity.authentication.encoding.DigestAuthPasswordEncoder

import static org.springframework.security.authentication.dao.DaoAuthenticationProvider.USER_NOT_FOUND_PASSWORD

/**
* @author <a href='mailto:burt@burtbeckwith.com'>Burt Beckwith</a>
*/
Expand All @@ -26,8 +26,7 @@ class DigestAuthPasswordEncoderSpec extends AbstractIntegrationSpec {
def daoAuthenticationProvider
def passwordEncoder

void 'initialize'() {

void 'test initialize'() {
when:
def providerPasswordEncoder = daoAuthenticationProvider.passwordEncoder

Expand Down
Expand Up @@ -14,14 +14,13 @@
*/
package grails.plugin.springsecurity

import java.text.SimpleDateFormat

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken

import grails.plugin.springsecurity.web.authentication.rememberme.GormPersistentTokenRepository
import groovy.sql.Sql
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken
import test.TestPersistentLogin

import java.text.SimpleDateFormat

/**
* Integration tests for <code>GormPersistentTokenRepository</code>, based on the tests
* for <code>JdbcTokenRepositoryImpl</code>.
Expand All @@ -43,7 +42,6 @@ class GormPersistentTokenRepositorySpec extends AbstractIntegrationSpec {
}

void 'create new token inserts correct data'() {

when:
Date currentDate = new Date()
def token = new PersistentRememberMeToken('joeuser', 'joesseries', 'atoken', currentDate)
Expand All @@ -65,7 +63,6 @@ class GormPersistentTokenRepositorySpec extends AbstractIntegrationSpec {
}

void 'retrieving token returns correct data'() {

when:
insertToken 'joesseries', 'joeuser', 'atoken', DATE

Expand Down

0 comments on commit 57369b8

Please sign in to comment.