X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ftest%2FMocks.kt;h=17eae9ad784d5bf4349c575e214b8a14b9741810;hb=be005506d77e048c7de43f08771b072951ab82f9;hp=3b2c716358e0cab379510c66b8e10464629e4830;hpb=f98ec5222b0611a7e473c01cb6ef3a4ef73bc294;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/test/Mocks.kt b/src/test/kotlin/net/pterodactylus/sone/test/Mocks.kt index 3b2c716..17eae9a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/test/Mocks.kt +++ b/src/test/kotlin/net/pterodactylus/sone/test/Mocks.kt @@ -1,5 +1,5 @@ /** - * Sone - Mocks.kt - Copyright © 2019 David ‘Bombe’ Roden + * Sone - Mocks.kt - Copyright © 2019–2020 David ‘Bombe’ Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +32,8 @@ val remoteSone2 = createRemoteSone() val localSone1 = createLocalSone() val localSone2 = createLocalSone() +val createRequestUri: FreenetURI get() = InsertableClientSSK.createRandom(DummyRandomSource(), "").uri +val createInsertUri: FreenetURI get() = InsertableClientSSK.createRandom(DummyRandomSource(), "").insertURI fun createId() = InsertableClientSSK.createRandom(DummyRandomSource(), "").uri.routingKey.asFreenetBase64 fun createLocalSone(id: String? = createId()) = object : IdOnlySone(id) { @@ -41,11 +43,12 @@ fun createLocalSone(id: String? = createId()) = object : IdOnlySone(id) { } fun createRemoteSone(id: String? = createId()) = IdOnlySone(id) -fun createPost(text: String = "", sone: Sone = remoteSone1, known: Boolean = false): Post.EmptyPost { +fun createPost(text: String = "", sone: Sone = remoteSone1, known: Boolean = false, time: Long = 1): Post.EmptyPost { return object : Post.EmptyPost("post-id") { override fun getSone() = sone override fun getText() = text override fun isKnown() = known + override fun getTime() = time } } @@ -59,3 +62,6 @@ fun emptyPostReply(text: String = "", post: Post? = createPost(), sone: Sone = r override fun isKnown() = known override fun setKnown(known: Boolean): PostReply = this } + +fun createImage(sone: Sone): Image = + ImageImpl().modify().setSone(sone).update()