kopia lustrzana https://gitlab.com/jaywink/federation
				
				
				
			Merge pull request #85 from jaywink/legacy-diaspora-requets-retraction
Support Diaspora legacy request retractionmerge-requests/130/head
						commit
						dd027d4699
					
				| 
						 | 
				
			
			@ -9,6 +9,9 @@
 | 
			
		|||
* New style Diaspora public payloads are now supported (see [here](https://github.com/diaspora/diaspora_federation/issues/30)). Old style payloads are still supported. Payloads are also still sent out old style.
 | 
			
		||||
* Add new `Follow` base entity and support for the new Diaspora "contact" payload. The simple `Follow` maps to Diaspora contact entity with following/sharing both true or false. Sharing as a separate concept is not currently supported.
 | 
			
		||||
 | 
			
		||||
### Fixed
 | 
			
		||||
* Legacy Diaspora retraction of sharing/following is now supported correctly. The end result is a `DiasporaRetraction` for entity type `Profile`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## [0.11.0] - 2017-05-08
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,6 +172,7 @@ class DiasporaRetraction(DiasporaEntityMixin, Retraction):
 | 
			
		|||
    mapped = {
 | 
			
		||||
        "Like": "Reaction",
 | 
			
		||||
        "Photo": "Image",
 | 
			
		||||
        "Person": "Profile",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def to_xml(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,8 @@ from federation.tests.fixtures.keys import get_dummy_private_key
 | 
			
		|||
from federation.tests.fixtures.payloads import (
 | 
			
		||||
    DIASPORA_POST_SIMPLE, DIASPORA_POST_COMMENT, DIASPORA_POST_LIKE,
 | 
			
		||||
    DIASPORA_REQUEST, DIASPORA_PROFILE, DIASPORA_POST_INVALID, DIASPORA_RETRACTION,
 | 
			
		||||
    DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY, DIASPORA_CONTACT)
 | 
			
		||||
    DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY, DIASPORA_CONTACT,
 | 
			
		||||
    DIASPORA_LEGACY_REQUEST_RETRACTION)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def mock_fill(attributes):
 | 
			
		||||
| 
						 | 
				
			
			@ -154,6 +155,15 @@ class TestDiasporaEntityMappersReceive():
 | 
			
		|||
        assert entity.target_guid == "x" * 16
 | 
			
		||||
        assert entity.entity_type == "Post"
 | 
			
		||||
 | 
			
		||||
    def test_message_to_objects_retraction_legacy_request(self):
 | 
			
		||||
        entities = message_to_objects(DIASPORA_LEGACY_REQUEST_RETRACTION)
 | 
			
		||||
        assert len(entities) == 1
 | 
			
		||||
        entity = entities[0]
 | 
			
		||||
        assert isinstance(entity, Retraction)
 | 
			
		||||
        assert entity.handle == "jaywink@iliketoast.net"
 | 
			
		||||
        assert entity.target_guid == "7ed1555bc6ae03db"
 | 
			
		||||
        assert entity.entity_type == "Profile"
 | 
			
		||||
 | 
			
		||||
    def test_message_to_objects_contact(self):
 | 
			
		||||
        entities = message_to_objects(DIASPORA_CONTACT)
 | 
			
		||||
        assert len(entities) == 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -174,6 +174,14 @@ DIASPORA_RETRACTION = """
 | 
			
		|||
    </retraction>
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
DIASPORA_LEGACY_REQUEST_RETRACTION = """
 | 
			
		||||
    <retraction>
 | 
			
		||||
        <diaspora_handle>jaywink@iliketoast.net</diaspora_handle>
 | 
			
		||||
        <post_guid>7ed1555bc6ae03db</post_guid>
 | 
			
		||||
        <type>Person</type>
 | 
			
		||||
    </retraction>
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
DIASPORA_CONTACT = """
 | 
			
		||||
    <contact>
 | 
			
		||||
        <author>alice@example.com</author>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue