Fix tests

pull/2075/head
Alex Baker 2 years ago
parent 67ace66204
commit 644eda1eef

@ -45,11 +45,11 @@ class CaldavSynchronizerTest : CaldavTest() {
@Test
fun dontFetchCalendarIfCtagMatches() = runBlocking {
caldavDao.insert(CaldavCalendar().apply {
account = this@CaldavSynchronizerTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@CaldavSynchronizerTest.account.url}test-shared/"
})
caldavDao.insert(CaldavCalendar(
account = this@CaldavSynchronizerTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@CaldavSynchronizerTest.account.url}test-shared/",
))
enqueue(OC_SHARE_PROPFIND)
sync()
@ -57,12 +57,12 @@ class CaldavSynchronizerTest : CaldavTest() {
@Test
fun dontFetchTaskIfEtagMatches() = runBlocking {
val calendar = CaldavCalendar().apply {
account = this@CaldavSynchronizerTest.account.uuid
uuid = UUIDHelper.newUUID()
url = "${this@CaldavSynchronizerTest.account.url}test-shared/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@CaldavSynchronizerTest.account.uuid,
uuid = UUIDHelper.newUUID(),
url = "${this@CaldavSynchronizerTest.account.url}test-shared/",
)
caldavDao.insert(calendar)
caldavDao.insert(newCaldavTask(
with(TASK, taskDao.insert(newTask())),
with(OBJECT, "3164728546640386952.ics"),

@ -29,12 +29,12 @@ class SharingMailboxDotOrgTest : CaldavTest() {
url = server.url("/caldav/").toString()
id = caldavDao.insert(this)
}
val calendar = CaldavCalendar().apply {
account = this@SharingMailboxDotOrgTest.account.uuid
ctag = "1614876450015"
url = "${this@SharingMailboxDotOrgTest.account.url}MzM/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingMailboxDotOrgTest.account.uuid,
ctag = "1614876450015",
url = "${this@SharingMailboxDotOrgTest.account.url}MzM/",
)
caldavDao.insert(calendar)
enqueue(SHARE_OWNER)
sync()
@ -52,12 +52,12 @@ class SharingMailboxDotOrgTest : CaldavTest() {
url = server.url("/caldav/").toString()
id = caldavDao.insert(this)
}
val calendar = CaldavCalendar().apply {
account = this@SharingMailboxDotOrgTest.account.uuid
ctag = "1614876450015"
url = "${this@SharingMailboxDotOrgTest.account.url}MzM/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingMailboxDotOrgTest.account.uuid,
ctag = "1614876450015",
url = "${this@SharingMailboxDotOrgTest.account.url}MzM/",
)
caldavDao.insert(calendar)
enqueue(SHARE_OWNER)
sync()

@ -33,12 +33,12 @@ class SharingOwncloudTest : CaldavTest() {
@Test
fun calendarOwner() = runBlocking {
setupAccount("user1")
val calendar = CaldavCalendar().apply {
account = this@SharingOwncloudTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingOwncloudTest.account.url}test-shared/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingOwncloudTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingOwncloudTest.account.url}test-shared/",
)
caldavDao.insert(calendar)
enqueue(OC_OWNER)
sync()
@ -49,12 +49,12 @@ class SharingOwncloudTest : CaldavTest() {
@Test
fun readOnly() = runBlocking {
setupAccount("user2")
val calendar = CaldavCalendar().apply {
account = this@SharingOwncloudTest.account.uuid
ctag = "http://sabre.io/ns/sync/2"
url = "${this@SharingOwncloudTest.account.url}test-shared_shared_by_user1/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingOwncloudTest.account.uuid,
ctag = "http://sabre.io/ns/sync/2",
url = "${this@SharingOwncloudTest.account.url}test-shared_shared_by_user1/",
)
caldavDao.insert(calendar)
enqueue(OC_READ_ONLY)
sync()
@ -65,12 +65,12 @@ class SharingOwncloudTest : CaldavTest() {
@Test
fun principalForSharee() = runBlocking {
setupAccount("user1")
val calendar = CaldavCalendar().apply {
account = this@SharingOwncloudTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingOwncloudTest.account.url}test-shared/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingOwncloudTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingOwncloudTest.account.url}test-shared/",
)
caldavDao.insert(calendar)
enqueue(OC_OWNER)
sync()
@ -89,12 +89,12 @@ class SharingOwncloudTest : CaldavTest() {
@Test
fun principalForOwner() = runBlocking {
setupAccount("user2")
val calendar = CaldavCalendar().apply {
account = this@SharingOwncloudTest.account.uuid
ctag = "http://sabre.io/ns/sync/2"
url = "${this@SharingOwncloudTest.account.url}test-shared_shared_by_user1/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingOwncloudTest.account.uuid,
ctag = "http://sabre.io/ns/sync/2",
url = "${this@SharingOwncloudTest.account.url}test-shared_shared_by_user1/",
)
caldavDao.insert(calendar)
enqueue(OC_READ_ONLY)
sync()

@ -35,12 +35,12 @@ class SharingSabredavTest : CaldavTest() {
@Test
fun calendarOwner() = runBlocking {
setupAccount("user1")
val calendar = CaldavCalendar().apply {
account = this@SharingSabredavTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingSabredavTest.account.url}940468858232147861/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingSabredavTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingSabredavTest.account.url}940468858232147861/",
)
caldavDao.insert(calendar)
enqueue(SD_OWNER)
sync()
@ -54,12 +54,12 @@ class SharingSabredavTest : CaldavTest() {
@Test
fun calendarSharee() = runBlocking {
setupAccount("user2")
val calendar = CaldavCalendar().apply {
account = this@SharingSabredavTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingSabredavTest.account.url}c3853d69-cb7a-476c-a23b-30ffd70f110b/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingSabredavTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingSabredavTest.account.url}c3853d69-cb7a-476c-a23b-30ffd70f110b/",
)
caldavDao.insert(calendar)
enqueue(SD_SHAREE)
sync()
@ -73,12 +73,13 @@ class SharingSabredavTest : CaldavTest() {
@Test
fun excludeCurrentUserPrincipalFromSharees() = runBlocking {
setupAccount("user1")
CaldavCalendar().apply {
account = this@SharingSabredavTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingSabredavTest.account.url}940468858232147861/"
caldavDao.insert(this)
}
caldavDao.insert(
CaldavCalendar(
account = account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${account.url}940468858232147861/",
)
)
enqueue(SD_OWNER)
sync()
@ -89,12 +90,12 @@ class SharingSabredavTest : CaldavTest() {
@Test
fun principalForSharee() = runBlocking {
setupAccount("user1")
val calendar = CaldavCalendar().apply {
account = this@SharingSabredavTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingSabredavTest.account.url}940468858232147861/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingSabredavTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingSabredavTest.account.url}940468858232147861/",
)
caldavDao.insert(calendar)
enqueue(SD_OWNER)
sync()
@ -111,12 +112,12 @@ class SharingSabredavTest : CaldavTest() {
@Test
fun principalForOwner() = runBlocking {
setupAccount("user2")
val calendar = CaldavCalendar().apply {
account = this@SharingSabredavTest.account.uuid
ctag = "http://sabre.io/ns/sync/1"
url = "${this@SharingSabredavTest.account.url}c3853d69-cb7a-476c-a23b-30ffd70f110b/"
caldavDao.insert(this)
}
val calendar = CaldavCalendar(
account = this@SharingSabredavTest.account.uuid,
ctag = "http://sabre.io/ns/sync/1",
url = "${this@SharingSabredavTest.account.url}c3853d69-cb7a-476c-a23b-30ffd70f110b/",
)
caldavDao.insert(calendar)
enqueue(SD_SHAREE)
sync()

@ -64,10 +64,12 @@ class OpenTasksSynchronizerTest : OpenTasksTest() {
@Test
fun removeMissingLists() = runBlocking {
val (_, list) = openTaskDao.insertList(url = "url1")
caldavDao.insert(CaldavCalendar().apply {
account = list.account
url = "url2"
})
caldavDao.insert(
CaldavCalendar(
account = list.account,
url = "url2",
)
)
synchronizer.sync()

@ -35,13 +35,14 @@ class TestOpenTaskDao @Inject constructor(
.withValue(TaskContract.TaskListColumns.LIST_NAME, name)
.withValue(TaskContract.TaskLists.SYNC_ENABLED, "1")
)
return Pair(result.uri!!.lastPathSegment!!.toLong(), CaldavCalendar().apply {
uuid = UUIDHelper.newUUID()
this.name = name
this.account = "$type:$account"
this.url = url
caldavDao.insert(this)
})
val calendar = CaldavCalendar(
uuid = UUIDHelper.newUUID(),
name = name,
account = "$type:$account",
url = url,
)
caldavDao.insert(calendar)
return Pair(result.uri!!.lastPathSegment!!.toLong(), calendar)
}
fun insertTask(listId: Long, vtodo: String) {

@ -11,11 +11,11 @@ object CaldavCalendarMaker {
val ACCOUNT: Property<CaldavCalendar, String> = newProperty()
val UUID: Property<CaldavCalendar, String> = newProperty()
private val instantiator = Instantiator<CaldavCalendar> { lookup ->
val calendar = CaldavCalendar()
calendar.account = lookup.valueOf(ACCOUNT, "account")
calendar.uuid = lookup.valueOf(UUID, "uuid")
calendar
private val instantiator = Instantiator { lookup ->
CaldavCalendar(
account = lookup.valueOf(ACCOUNT, "account"),
uuid = lookup.valueOf(UUID, "uuid"),
)
}
fun newCaldavCalendar(vararg properties: PropertyValue<in CaldavCalendar?, *>): CaldavCalendar {

Loading…
Cancel
Save