kopia lustrzana https://gitlab.com/jaywink/federation
				
				
				
			fix a test and remove unused import.
							rodzic
							
								
									5b641a657a
								
							
						
					
					
						commit
						2342b193b1
					
				| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
from copy import copy
 | 
					from copy import copy
 | 
				
			||||||
from functools import cache
 | 
					 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
from typing import List, Callable, Dict, Union, Optional
 | 
					from typing import List, Callable, Dict, Union, Optional
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,6 @@ from unittest.mock import patch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from federation.entities.activitypub.mappers import get_outbound_entity
 | 
					from federation.entities.activitypub.mappers import get_outbound_entity
 | 
				
			||||||
import federation.entities.activitypub.models as models
 | 
					import federation.entities.activitypub.models as models
 | 
				
			||||||
from federation.entities.activitypub.models import make_content_class
 | 
					 | 
				
			||||||
from federation.entities.base import Profile, Post, Comment, Retraction
 | 
					from federation.entities.base import Profile, Post, Comment, Retraction
 | 
				
			||||||
from federation.entities.diaspora.entities import (
 | 
					from federation.entities.diaspora.entities import (
 | 
				
			||||||
    DiasporaPost, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction,
 | 
					    DiasporaPost, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction,
 | 
				
			||||||
| 
						 | 
					@ -29,7 +28,7 @@ def activitypubannounce():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubcomment():
 | 
					def activitypubcomment():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Comment)(
 | 
					        obj = models.Comment(
 | 
				
			||||||
            raw_content="raw_content",
 | 
					            raw_content="raw_content",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -64,7 +63,7 @@ def activitypubaccept(activitypubfollow):
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost():
 | 
					def activitypubpost():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="# raw_content",
 | 
					            raw_content="# raw_content",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -82,7 +81,7 @@ def activitypubpost():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost_diaspora_guid():
 | 
					def activitypubpost_diaspora_guid():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="raw_content",
 | 
					            raw_content="raw_content",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -98,7 +97,7 @@ def activitypubpost_diaspora_guid():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost_images():
 | 
					def activitypubpost_images():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="raw_content",
 | 
					            raw_content="raw_content",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -117,7 +116,7 @@ def activitypubpost_images():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost_mentions():
 | 
					def activitypubpost_mentions():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="""# raw_content\n\n@someone@localhost.local @jaywink@localhost.local""",
 | 
					            raw_content="""# raw_content\n\n@someone@localhost.local @jaywink@localhost.local""",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -137,7 +136,7 @@ def activitypubpost_mentions():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost_tags():
 | 
					def activitypubpost_tags():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="# raw_content\n#foobar\n#barfoo",
 | 
					            raw_content="# raw_content\n#foobar\n#barfoo",
 | 
				
			||||||
            public=True,
 | 
					            public=True,
 | 
				
			||||||
            provider_display_name="Socialhome",
 | 
					            provider_display_name="Socialhome",
 | 
				
			||||||
| 
						 | 
					@ -152,7 +151,7 @@ def activitypubpost_tags():
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def activitypubpost_embedded_images():
 | 
					def activitypubpost_embedded_images():
 | 
				
			||||||
    with freeze_time("2019-04-27"):
 | 
					    with freeze_time("2019-04-27"):
 | 
				
			||||||
        obj = make_content_class(Post)(
 | 
					        obj = models.Post(
 | 
				
			||||||
            raw_content="""
 | 
					            raw_content="""
 | 
				
			||||||
#Cycling #lauttasaari #sea #sun
 | 
					#Cycling #lauttasaari #sea #sun
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -404,7 +403,7 @@ def diasporaretraction():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def post():
 | 
					def post():
 | 
				
			||||||
    return Post(
 | 
					    return models.Post(
 | 
				
			||||||
        raw_content="""One more test before sleep 😅 This time with an image.
 | 
					        raw_content="""One more test before sleep 😅 This time with an image.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
""",
 | 
					""",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue