summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2015-02-07 21:24:08 +0000
committerMatthew Hodgson <matthew@matrix.org>2015-02-07 21:24:08 +0000
commit37b6b880ef084f2cdd3cce1a275aa46764131c91 (patch)
tree48843b7c3fdbb5359931afc61ca063397f0dfbb1
parentadd some options and doc (diff)
downloadsynapse-37b6b880ef084f2cdd3cce1a275aa46764131c91.tar.xz
don't give up if we can't create default avatars during tests
-rw-r--r--synapse/handlers/register.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 2b9d860084..4f06c487b1 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -103,15 +103,18 @@ class RegistrationHandler(BaseHandler):
         # XXX: ideally clients would explicitly specify one, but given they don't
         # and we want consistent and pretty identicons for random users, we'll
         # do it here.
-        auth_user = UserID.from_string(user_id)
-        identicon_resource = self.hs.get_resource_for_media_repository().getChildWithDefault("identicon", None)
-        upload_resource = self.hs.get_resource_for_media_repository().getChildWithDefault("upload", None)
-        identicon_bytes = identicon_resource.generate_identicon(user_id, 320, 320)
-        content_uri = yield upload_resource.create_content(
-            "image/png", None, identicon_bytes, len(identicon_bytes), auth_user
-        )
-        profile_handler = self.hs.get_handlers().profile_handler
-        profile_handler.set_avatar_url(auth_user, auth_user, ("%s#auto" % content_uri))
+        try:
+            auth_user = UserID.from_string(user_id)
+            identicon_resource = self.hs.get_resource_for_media_repository().getChildWithDefault("identicon", None)
+            upload_resource = self.hs.get_resource_for_media_repository().getChildWithDefault("upload", None)
+            identicon_bytes = identicon_resource.generate_identicon(user_id, 320, 320)
+            content_uri = yield upload_resource.create_content(
+                "image/png", None, identicon_bytes, len(identicon_bytes), auth_user
+            )
+            profile_handler = self.hs.get_handlers().profile_handler
+            profile_handler.set_avatar_url(auth_user, auth_user, ("%s#auto" % content_uri))
+        except NotImplementedError:
+            pass # make tests pass without messing around creating default avatars
         
         defer.returnValue((user_id, token))