mirror of https://github.com/zlatinb/muwire
update test for new json format
parent
8f3b5aea8d
commit
8f6b6b0caa
|
@ -8,6 +8,7 @@ import com.muwire.core.Destinations
|
||||||
import com.muwire.core.Persona
|
import com.muwire.core.Persona
|
||||||
import com.muwire.core.Personas
|
import com.muwire.core.Personas
|
||||||
|
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
import net.i2p.data.Base64
|
import net.i2p.data.Base64
|
||||||
import net.i2p.data.Destination
|
import net.i2p.data.Destination
|
||||||
|
|
||||||
|
@ -55,13 +56,16 @@ class TrustServiceTest {
|
||||||
service.onTrustEvent new TrustEvent(level: TrustLevel.DISTRUSTED, persona: personas.persona2)
|
service.onTrustEvent new TrustEvent(level: TrustLevel.DISTRUSTED, persona: personas.persona2)
|
||||||
|
|
||||||
Thread.sleep(250)
|
Thread.sleep(250)
|
||||||
|
JsonSlurper slurper = new JsonSlurper()
|
||||||
def trusted = new HashSet<>()
|
def trusted = new HashSet<>()
|
||||||
persistGood.eachLine {
|
persistGood.eachLine {
|
||||||
trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it))))
|
def json = slurper.parseText(it)
|
||||||
|
trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona))))
|
||||||
}
|
}
|
||||||
def distrusted = new HashSet<>()
|
def distrusted = new HashSet<>()
|
||||||
persistBad.eachLine {
|
persistBad.eachLine {
|
||||||
distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it))))
|
def json = slurper.parseText(it)
|
||||||
|
distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona))))
|
||||||
}
|
}
|
||||||
|
|
||||||
assert trusted.size() == 1
|
assert trusted.size() == 1
|
||||||
|
|
Loading…
Reference in New Issue