summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/twisted/avahi/file-transfer/metadata.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/twisted/avahi/file-transfer/metadata.py b/tests/twisted/avahi/file-transfer/metadata.py
index b044e965..37736d1f 100644
--- a/tests/twisted/avahi/file-transfer/metadata.py
+++ b/tests/twisted/avahi/file-transfer/metadata.py
@@ -4,6 +4,7 @@ import dbus
from saluttest import exec_test
from file_transfer_helper import ReceiveFileTest, SendFileTest
+from servicetest import call_async
import constants as cs
@@ -17,9 +18,39 @@ class ReceiveFileNoMetadata(ReceiveFileTest):
service_name = ''
metadata = {}
+class SendFileBadProps(SendFileTest):
+ metadata = {'FORM_TYPE': 'this shouldnt be allowed'}
+
+ def request_ft_channel(self):
+ requests_iface = dbus.Interface(self.conn, cs.CONN_IFACE_REQUESTS)
+
+ request = { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_FILE_TRANSFER,
+ cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+ cs.TARGET_HANDLE: self.handle,
+ cs.FT_CONTENT_TYPE: self.file.content_type,
+ cs.FT_FILENAME: self.file.name,
+ cs.FT_SIZE: self.file.size,
+ cs.FT_CONTENT_HASH_TYPE: self.file.hash_type,
+ cs.FT_CONTENT_HASH: self.file.hash,
+ cs.FT_DESCRIPTION: self.file.description,
+ cs.FT_DATE: self.file.date,
+ cs.FT_INITIAL_OFFSET: 0,
+ cs.FT_SERVICE_NAME: self.service_name,
+ cs.FT_METADATA: dbus.Dictionary(self.metadata, signature='ss')}
+
+ call_async(self.q, requests_iface, 'CreateChannel', request)
+
+ # FORM_TYPE is not allowed, soz
+ self.q.expect('dbus-error', method='CreateChannel', name=cs.INVALID_ARGUMENT)
+
+ return True
+
if __name__ == '__main__':
test = SendFileNoMetadata()
exec_test(test.test)
test = ReceiveFileNoMetadata()
exec_test(test.test)
+
+ test = SendFileBadProps()
+ exec_test(test.test)