コード例 #1
0
    def setUp(self) -> None:
        super().setUp()

        obj = testfunc.create_mentionable_object(
            "Content that might mention a URL")
        self.absolute_url = obj.get_absolute_url()
        self.all_text = obj.all_text()
コード例 #2
0
    def test_get_endpoint(self):
        """`/get` endpoint is accessible."""
        obj = testfunc.create_mentionable_object()

        response = self.client.get(testfunc.endpoint_get_webmentions(),
                                   data={"url": obj.get_absolute_url()})
        self.assertEqual(200, response.status_code)
コード例 #3
0
    def setUp(self) -> None:
        super().setUp()

        obj = testfunc.create_mentionable_object()
        self.source = testfunc.random_url()
        self.target = testfunc.get_absolute_url_for_object(obj)
        self.http_post = QueryDict(
            f"source={self.source}&target={self.target}")
        self.sent_by = "localhost"
コード例 #4
0
    def setUp(self) -> None:
        super().setUp()

        source = testfunc.random_url()
        obj = testfunc.create_mentionable_object(content=testfunc.random_str())

        PendingIncomingWebmention.objects.create(
            source_url=source,
            target_url=testfunc.get_absolute_url_for_object(obj),
            sent_by="localhost",
        )
        PendingOutgoingContent.objects.create(
            absolute_url=obj.get_absolute_url(),
            text=obj.content,
        )
コード例 #5
0
    def setUp(self):
        self.target_object = testfunc.create_mentionable_object()
        self.webmention_source_url = testfunc.random_url()
        self.simplemention_source_url = testfunc.random_url()

        Webmention.objects.create(
            source_url=self.webmention_source_url,
            target_object=self.target_object,
            validated=True,
            approved=True,
        )

        SimpleMention.objects.create(
            source_url=self.simplemention_source_url,
            target_object=self.target_object,
        )
コード例 #6
0
 def setUp(self):
     self.target = testfunc.create_mentionable_object()
     self.target_url = testfunc.get_absolute_url_for_object(self.target)
コード例 #7
0
 def setUp(self):
     _create_mentionable_objects()
     self.target = testfunc.create_mentionable_object()
     _create_mentionable_objects()
コード例 #8
0
def _create_mentionable_objects(n: int = 3):
    """Create some arbitrary mentionable objects for noise."""

    for x in range(n):
        testfunc.create_mentionable_object()