Beispiel #1
0
    def test_activity_to_model(self):
        ''' create a model instance from an activity object '''
        activity = activitypub.Quotation(**self.status_data)
        quotation = activity.to_model(models.Quotation)

        self.assertEqual(quotation.book, self.book)
        self.assertEqual(quotation.user, self.user)
Beispiel #2
0
    def test_quotation_activity(self):
        quotation = activitypub.Quotation(**self.status_data)

        self.assertEqual(quotation.type, 'Quotation')
        self.assertEqual(quotation.id,
                         'https://example.com/user/mouse/quotation/13')
        self.assertEqual(quotation.content, 'commentary')
        self.assertEqual(quotation.quote, 'quote body')
        self.assertEqual(quotation.inReplyToBook, 'https://example.com/book/1')
        self.assertEqual(quotation.published,
                         '2020-05-10T02:38:31.150343+00:00')
Beispiel #3
0
    def test_quotation_activity(self):
        """create a Quoteation ap object from json"""
        quotation = activitypub.Quotation(**self.status_data)

        self.assertEqual(quotation.type, "Quotation")
        self.assertEqual(quotation.id,
                         "https://example.com/user/mouse/quotation/13")
        self.assertEqual(quotation.content, "commentary")
        self.assertEqual(quotation.quote, "quote body")
        self.assertEqual(quotation.inReplyToBook, "https://example.com/book/1")
        self.assertEqual(quotation.published,
                         "2020-05-10T02:38:31.150343+00:00")
Beispiel #4
0
    def test_activity_to_model(self):
        activity = activitypub.Quotation(**self.status_data)
        quotation = activity.to_model(models.Quotation)

        self.assertEqual(quotation.book, self.book)
        self.assertEqual(quotation.user, self.user)