Skip to content

Commit

Permalink
Merge pull request #453 from joesondow/assert-no-other-mock-methods-c…
Browse files Browse the repository at this point in the history
…alled

Explicitly asserted that no other mock methods are called
  • Loading branch information
joesondow committed Jan 3, 2014
2 parents 09980cd + 113c16c commit e78efea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/unit/com/netflix/asgard/AwsEc2ServiceUnitSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ and groupName is #groupName""")
new SubnetData(subnetId: 'subnet-e9b0a3a4', availabilityZone: 'us-east-1a', purpose: 'external',
target: SubnetTarget.ELB),
]
0 * _
}

private Collection<SecurityGroup> simulateWarGames() {
Expand Down Expand Up @@ -388,6 +389,7 @@ and groupName is #groupName""")
new SecurityGroupOption('wopr', 'joshua', false, '7001'),
]
1 * mockSecurityGroupCache.list() >> { warGamesSecurityGroups }
0 * _
}

def 'options for source group should include all groups sorted, but only some allowed to be called by source'() {
Expand All @@ -409,6 +411,7 @@ and groupName is #groupName""")
new SecurityGroupOption('joshua', 'wopr', true, '7101-7102'),
]
1 * mockSecurityGroupCache.list() >> { simulateWarGames() }
0 * _
}

def 'should update security groups'() {
Expand Down Expand Up @@ -453,6 +456,7 @@ and groupName is #groupName""")
new Subnet(subnetId: 'subnet-vader', vpcId: 'vpc-123'),
new Subnet(subnetId: 'subnet-palpatine', vpcId: 'vpc-123')
]
0 * _
}

def 'should get zero subnet IDs for default VPC if no default VPC exists'() {
Expand All @@ -463,5 +467,6 @@ and groupName is #groupName""")
then:
subnetIds == []
1 * mockVpcCache.list() >> [new Vpc(vpcId: 'vpc-123')]
0 * _
}
}

0 comments on commit e78efea

Please sign in to comment.