kopia lustrzana https://gitlab.com/jaywink/federation
Merge pull request #64 from jaywink/profile-optional-raw-content
Made Profile.raw_content optionalmerge-requests/130/head
commit
e4e2cb47fb
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [unreleased]
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* Made `Profile.raw_content` optional. This fixes validating profiles parsed from Diaspora hCard's.
|
||||||
|
|
||||||
## [0.9.0] - 2016-12-10
|
## [0.9.0] - 2016-12-10
|
||||||
|
|
||||||
### Backwards incompatible changes
|
### Backwards incompatible changes
|
||||||
|
|
|
@ -253,7 +253,7 @@ class Relationship(CreatedAtMixin, HandleMixin):
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class Profile(CreatedAtMixin, HandleMixin, RawContentMixin, PublicMixin, GUIDMixin):
|
class Profile(CreatedAtMixin, HandleMixin, OptionalRawContentMixin, PublicMixin, GUIDMixin):
|
||||||
"""Represents a profile for a user."""
|
"""Represents a profile for a user."""
|
||||||
name = ""
|
name = ""
|
||||||
email = ""
|
email = ""
|
||||||
|
|
|
@ -115,7 +115,7 @@ class TestParseProfileFromHCard(object):
|
||||||
def test_profile_is_parsed(self):
|
def test_profile_is_parsed(self):
|
||||||
hcard = generate_hcard(
|
hcard = generate_hcard(
|
||||||
"diaspora",
|
"diaspora",
|
||||||
hostname="https://hostname",
|
hostname="https://example.com",
|
||||||
fullname="fullname",
|
fullname="fullname",
|
||||||
firstname="firstname",
|
firstname="firstname",
|
||||||
lastname="lastname",
|
lastname="lastname",
|
||||||
|
@ -123,19 +123,20 @@ class TestParseProfileFromHCard(object):
|
||||||
photo100="photo100",
|
photo100="photo100",
|
||||||
photo50="photo50",
|
photo50="photo50",
|
||||||
searchable="true",
|
searchable="true",
|
||||||
guid="guid",
|
guid="guidguidguidguid",
|
||||||
public_key="public_key",
|
public_key="public_key",
|
||||||
username="username",
|
username="username",
|
||||||
)
|
)
|
||||||
profile = parse_profile_from_hcard(hcard, "username@hostname")
|
profile = parse_profile_from_hcard(hcard, "username@example.com")
|
||||||
assert profile.name == "fullname"
|
assert profile.name == "fullname"
|
||||||
assert profile.image_urls == {
|
assert profile.image_urls == {
|
||||||
"small": "photo50", "medium": "photo100", "large": "photo300"
|
"small": "photo50", "medium": "photo100", "large": "photo300"
|
||||||
}
|
}
|
||||||
assert profile.public == True
|
assert profile.public == True
|
||||||
assert profile.handle == "username@hostname"
|
assert profile.handle == "username@example.com"
|
||||||
assert profile.guid == "guid"
|
assert profile.guid == "guidguidguidguid"
|
||||||
assert profile.public_key == "public_key\n"
|
assert profile.public_key == "public_key\n"
|
||||||
|
profile.validate()
|
||||||
|
|
||||||
|
|
||||||
class TestRetrieveAndParseProfile(object):
|
class TestRetrieveAndParseProfile(object):
|
||||||
|
|
Ładowanie…
Reference in New Issue