Skip to content

Commit

Permalink
improving test: check the return value from the key storage
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Apr 21, 2021
1 parent d0eac7b commit fcf4a9f
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@ class ScriptPluginResourceModelSourceFactorySpec extends Specification{
given:

def storageTree = Mock(KeyStorageTree)
storageTree.getResource(_) >> Mock(Resource) {
getContents() >> Mock(ResourceMeta) {
writeContent(_) >> { args ->
args[0].write('password'.bytes)
return 6L
}
}
}

Services services = Mock(Services){
getService(KeyStorageTree.class) >> storageTree
}
Services services = Mock(Services)

Properties configuration = new Properties()
configuration.put("project",PROJECT_NAME)
Expand Down Expand Up @@ -93,8 +82,19 @@ class ScriptPluginResourceModelSourceFactorySpec extends Specification{
def resource = pluginFactory.createResourceModelSource(services, configuration)

then:
resource !=null
1 * services.getService(KeyStorageTree.class) >> storageTree
storageTree.getResource(_) >> Mock(Resource) {
1* getContents() >> Mock(ResourceMeta) {
writeContent(_) >> { args ->
args[0].write('password'.bytes)
return 6L
}
}
}

resource !=null
resource.configuration.getProperty("token") != null
resource.configuration.getProperty("token") == "password"
}


Expand Down

0 comments on commit fcf4a9f

Please sign in to comment.