[Zope-CVS] CVS: Packages/Moztop/moztop/content/lib/tests - test_dav.html:1.3
Stephan Richter
srichter@cbu.edu
Sun, 25 May 2003 15:11:56 -0400
Update of /cvs-repository/Packages/Moztop/moztop/content/lib/tests
In directory cvs.zope.org:/tmp/cvs-serv31071/moztop/content/lib/tests
Modified Files:
test_dav.html
Log Message:
making prelinary checkin; I dunno whether anything works
=== Packages/Moztop/moztop/content/lib/tests/test_dav.html 1.2 => 1.3 ===
--- Packages/Moztop/moztop/content/lib/tests/test_dav.html:1.2 Tue Apr 1 08:02:07 2003
+++ Packages/Moztop/moztop/content/lib/tests/test_dav.html Sun May 25 15:11:55 2003
@@ -51,6 +51,89 @@
var serializer = new XMLSerializer();
+
+/* HTTP Methods tests. They really just test the most basic
+ * functionality. More complicated tests would fall under functional tests,
+ * which I do not want to perform in this unit tests package.
+ *
+ * Note: The tests assume that there is a WebDav server running. See
+ * WEBDAV_ROOT_URL to change the settings. */
+
+WEBDAV_ROOT_URL='http://localhost:9080/'
+
+function XXX_testBasicPROPFIND() {
+
+ var client = new DavClient();
+
+ function callback(status) {
+ alert(
+ status.getResponses()[0]
+ .getPropStats()[0].getProp().getProperties()
+ );
+ }
+
+ pf = new DavPropFind();
+ pf.setPropName();
+ client.PROPFIND(WEBDAV_ROOT_URL, pf, DAV_RESOURCE_DEPTH, callback);
+
+
+}
+
+
+/* Beginning of XML Elements tests */
+
+// function testDavActiveLockConstructor() {
+// var d = new DavActiveLock();
+// assertEquals(null, d.lockscope);
+// assertEquals(null, d.locktype);
+// assertEquals(null, d.depth);
+// assertEquals(null, d.owner);
+// assertEquals(null, d.timeout);
+// assertEquals(null, d.locktoken);
+//
+// var d = new DavActiveLock(owner='stephan');
+// assertEquals(null, d.lockscope);
+// assertEquals(null, d.locktype);
+// assertEquals(null, d.depth);
+// assertEquals('stephan', d.owner);
+// assertEquals(null, d.timeout);
+// assertEquals(null, d.locktoken);
+//
+// }
+//
+//
+// function testDavActiveLockGetSetScope() {
+// scope = new DavLockScope();
+// var d = new DavActiveLock(scope);
+// assertEquals(scope, d.getScope());
+// scope2 = new DavLockScope(DAV_EXCLUSIVE_LOCKSCOPE);
+// d.setValue(scope2)
+// assertEquals(scope2, d.value);
+// try {
+// d.setValue('foo');
+// }
+// catch(error) {
+// assertEquals(("The value 'foo' is not a valid depth. Use one of the " +
+// "following values instead: 0, 1, infinity"),
+// error.serialize());
+// }
+// }
+//
+// function _XXX_testDavActiveLockParseXML() {
+// throw 'IncompleteTest';
+// }
+//
+// function testDavActiveLockCreateXML() {
+// var d = new DavActiveLock('0');
+// var doc = document.implementation.createDocument("DAV:", "D:test",
+// null);
+// var node = doc.documentElement;
+// d.createXML(node, doc);
+// assertEquals('<a0:depth xmlns:a0="DAV:">0</a0:depth>',
+// serializer.serializeToString(node));
+// }
+
+
/*
function testDavDepthConstructor() {
var d = new DavDepth('0');
@@ -513,7 +596,78 @@
function testDavLockTypeConstants() {
assertEquals("write", DAV_WRITE_LOCKTYPE);
}
-*/
+
+
+function testDavResourceTypeConstructor() {
+ var dst = new DavResourceType('Folder');
+ assertEquals('Folder', dst.value);
+ var dst = new DavResourceType();
+ assertEquals('', dst.value);
+}
+
+
+function testDavResourceTypeGetSetValue() {
+ var dst = new DavResourceType('Folder');
+ assertEquals('Folder', dst.getValue());
+ dst.setValue('Image');
+ assertEquals('Image', dst.value);
+}
+
+
+function _XXX_testDavResourceTypeParseXML() {
+ throw 'IncompleteTest';
+}
+
+function testDavResourceTypeCreateXML() {
+ var type = new DavResourceType('Folder');
+ var doc = document.implementation.createDocument("DAV:", "D:test",
+ null);
+ var node = doc.documentElement;
+ type.createXML(node, doc);
+ assertEquals('<a0:resourcetype xmlns:a0="DAV:">Folder</a0:resourcetype>',
+ serializer.serializeToString(node));
+}
+
+
+function testDavSourceConstructor() {
+ var lock = new DavSource();
+ assertEquals(0, lock.links.length);
+}
+
+
+function testDavSourceGetAddLink() {
+ var source = new DavSource();
+ var link1 = new DavLink();
+ var link2 = new DavLink();
+ source.links = [link1];
+ assertEquals(link1, source.getLinks()[0]);
+ source.addLink(link2);
+ assertEquals(link1, source.getLinks()[0]);
+ assertEquals(link2, source.getLinks()[1]);
+}
+
+
+function _XXX_testDavSourceParseXML() {
+ throw 'IncompleteTest';
+}
+
+
+function testDavSourceCreateXML() {
+ var source = new DavSource();
+ source.links[0] = new DavLink();
+ source.links[0].addSource(new DavSrc('test1.html'));
+ source.links[0].addDestination(new DavDst('test2.html'));
+ var doc = document.implementation.createDocument("DAV:", "D:test",
+ null);
+
+ var node = doc.documentElement;
+ source.createXML(node, doc);
+ assertEquals(
+ '<a0:source xmlns:a0="DAV:"><a0:link><a0:src>test1.html</a0:src>' +
+ '<a0:dst>test2.html</a0:dst></a0:link></a0:source>',
+ serializer.serializeToString(node));
+}
+
function testDavSupportedLockConstructor() {
var lock = new DavSupportedLock();
@@ -551,7 +705,7 @@
'</a0:locktype></a0:lockentry></a0:supportedlock>',
serializer.serializeToString(node));
}
-
+*/
</script>
<script type="application/x-javascript"