mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 23:12:40 +00:00
test: migration from Python to JavaScript
This commit is contained in:
1 parent
a14c456800
commit
2b101a87b8
8 files changed
+151
-14
No files matched your search
+10
-3
@@ -77,9 +77,16 @@ class WebDAV {
|
||||
})
|
||||
}
|
||||
|
||||
getEvent(resource, filename) {
|
||||
getObject(resource, filename) {
|
||||
let url
|
||||
if (resource.match(/^http/))
|
||||
url = resource
|
||||
else
|
||||
url = this.serverUrl + resource
|
||||
if (filename)
|
||||
url += filename
|
||||
return davRequest({
|
||||
url: this.serverUrl + resource + filename,
|
||||
url,
|
||||
init: {
|
||||
method: 'GET',
|
||||
headers: this.headers,
|
||||
@@ -380,7 +387,7 @@ class WebDAV {
|
||||
})
|
||||
}
|
||||
|
||||
makeAddressBook(resource) {
|
||||
makeCollection(resource) {
|
||||
return makeCollection({
|
||||
url: this.serverUrl + resource,
|
||||
headers: this.headers
|
||||
|
||||
@@ -143,8 +143,8 @@ class TestUtility {
|
||||
return this._subscriptionOperation(resource, subscribers, 'unsubscribe')
|
||||
}
|
||||
|
||||
versitDict(cal) {
|
||||
const comp = ICAL.Component.fromString(cal)
|
||||
versitDict(component) {
|
||||
const comp = ICAL.Component.fromString(component)
|
||||
let props = {}
|
||||
|
||||
for (const prop of comp.getAllProperties()) {
|
||||
@@ -158,9 +158,9 @@ class TestUtility {
|
||||
return props
|
||||
}
|
||||
|
||||
calendarsAreEqual(cal1, cal2) {
|
||||
const props1 = this.versitDict(cal1)
|
||||
const props2 = this.versitDict(cal2)
|
||||
componentsAreEqual(comp1, comp2) {
|
||||
const props1 = this.versitDict(comp1)
|
||||
const props2 = this.versitDict(comp2)
|
||||
for (const prop of Object.keys(props1)) {
|
||||
if (props1[prop] != props2[prop]) {
|
||||
console.debug(`Difference detected in ${prop}:\n\t1: ${props1[prop]}\n\t2: ${props2[prop]}`)
|
||||
|
||||
Reference in new issue
Block a user