Skip to content

Commit

Permalink
Updated tests #994
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Sep 17, 2024
1 parent a83a3f7 commit e62a356
Showing 1 changed file with 2 additions and 58 deletions.
60 changes: 2 additions & 58 deletions src/test/groovy/au/org/ala/ecodata/OrganisationServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OrganisationServiceSpec extends Specification implements ServiceUnitTest<O
def result
when:
Organisation.withNewTransaction {
result = service.create(orgData)
result = service.create(orgData, true)
}
then: "ensure the response contains the id of the new organisation"
result.status == 'ok'
Expand All @@ -69,7 +69,7 @@ class OrganisationServiceSpec extends Specification implements ServiceUnitTest<O
when:
Map result
Organisation.withNewTransaction {
result = service.create(orgData)
result = service.create(orgData, true)
}

then:
Expand All @@ -94,60 +94,4 @@ class OrganisationServiceSpec extends Specification implements ServiceUnitTest<O

}

/*
def "test organisation views"() {
// The dbo property on the domain object appears to be missing during unit tests which prevents toMap from working.
given:
// def orgId = 'organisation_id'
def projects = [[projectId:'1'], [projectId:'2']]
def orgId = Identifiers.getNew(true, '')
def org = new Organisation(organisationId: orgId, name: 'a test org', description: 'a test org description')
// Organisation.withNewTransaction {
// service.create(org)
// }
// Organisation.withNewTransaction {
org.save(flush: true, failOnError: true)
// }
ProjectService projectService = Mock(ProjectService)
service.projectService = projectService
projectService.search([organisationId: orgId]) >> projects
projectService.search([orgIdSvcProvider: orgId]) >> []
when:
def result
// print (orgId)
// Organisation.withNewTransaction {
result = service.get(orgId)
// print result
// }
// def result = service.toMap(org)
then:
result.organisationId == orgId
result.name == org.name
result.description == org.description
result.projects == null
when:
// Organisation.withNewTransaction {
// result = service.get(orgId, [OrganisationService.PROJECTS])
// print result
// }
def result1 = service.toMap(org, [OrganisationService.PROJECTS])
then:
result1.organisationId == orgId
result1.name == org.name
result1.description == org.description
result1.dynamicProperty == org['dynamicProperty']
result1.projects == projects
}
*/




}

0 comments on commit e62a356

Please sign in to comment.