コード例 #1
0
 def test_is_following_tag_with_flag(self):
     src = '{% is_following user group "liking" as is_following %}' \
           '{% if is_following %}yup{% endif %}'
     self.assertEqual(
         render(src, user=self.user4, group=self.another_group), 'yup')
     self.assertEqual(
         render(src, user=self.user1, group=self.another_group), '')
コード例 #2
0
 def test_is_following_tag_with_verb_variable(self):
     src = '{% is_following user group verb as is_following %}' \
           '{% if is_following %}yup{% endif %}'
     self.assertEqual(
         render(src,
                user=self.user4,
                group=self.another_group,
                verb='liking'), 'yup')
     self.assertEqual(
         render(src,
                user=self.user1,
                group=self.another_group,
                verb='liking'), '')
コード例 #3
0
 def test_tag_follow_all_url(self):
     src = '{% follow_all_url user %}'
     output = render(src, user=self.user1)
     self.assertEqual(
         output,
         reverse('actstream_follow_all',
                 args=(self.user_ct.pk, self.user1.pk)))
コード例 #4
0
 def test_tag_activity_stream(self):
     output = render('''{% activity_stream 'actor' user as='mystream' %}
     {% for action in mystream %}
         {{ action }}
     {% endfor %}
     ''', user=self.user1)
     self.assertAllIn([str(action) for action in actor_stream(self.user1)],
                      output)
コード例 #5
0
 def test_tag_follow_all_url_with_flag(self):
     src = '{% follow_all_url user "liking" %}'
     output = render(src, user=self.user1)
     self.assertEqual(output, reverse('actstream_follow_all', kwargs={
         'content_type_id': self.user_ct.pk,
         'object_id': self.user1.pk,
         'flag': 'liking'
     }))
コード例 #6
0
 def test_tag_follow_all_url_with_flag(self):
     src = '{% follow_all_url user "liking" %}'
     output = render(src, user=self.user1)
     self.assertEqual(output, reverse('actstream_follow_all', kwargs={
         'content_type_id': self.user_ct.pk,
         'object_id': self.user1.pk,
         'flag': 'liking'
     }))
コード例 #7
0
 def test_tag_activity_stream(self):
     output = render('''{% activity_stream 'actor' user as='mystream' %}
     {% for action in mystream %}
         {{ action }}
     {% endfor %}
     ''', user=self.user1)
     self.assertAllIn([str(action) for action in actor_stream(self.user1)],
                      output)
コード例 #8
0
 def test_tag_custom_activity_stream(self):
     stream = self.user.actor_actions.testbar('was created')
     output = render('''{% activity_stream 'testbar' 'was created' %}
     {% for action in stream %}
         {{ action }}
     {% endfor %}
     ''', user=self.user)
     self.assertAllIn([str(action) for action in stream], output)
コード例 #9
0
    def test_tag_custom_activity_stream(self):
        stream = self.user.actor_actions.testbar('was created')
        output = render('''{% activity_stream 'testbar' 'was created' %}
        {% for action in stream %}
            {{ action }}
        {% endfor %}
        ''', user=self.user)
        self.assertAllIn([str(action) for action in stream], output)

        self.assertEqual(self.capture('testapp_custom_feed',
                                      'was created')['totalItems'], 1)
コード例 #10
0
 def test_tag_follow_url_with_certain_type(self):
     src = '{% follow_url user liking %}'
     output = render(src, user=self.user1)
     self.assertEqual(
         output,
         reverse('actstream_follow',
                 kwargs={
                     'content_type_id': self.user_ct.pk,
                     'object_id': self.user1.pk,
                     'follow_type': 'liking'
                 }))
コード例 #11
0
    def test_tag_custom_activity_stream(self):
        stream = self.user.actor_actions.testbar('was created')
        output = render('''{% activity_stream 'testbar' 'was created' %}
        {% for action in stream %}
            {{ action }}
        {% endfor %}
        ''', user=self.user)
        self.assertAllIn([str(action) for action in stream], output)

        self.assertEqual(self.capture('testapp_custom_feed',
                                      'was created')['totalItems'], 1)
コード例 #12
0
 def test_is_following_tag_with_certain_type(self):
     src = '{% is_following user group liking as is_following %}' \
           '{% if is_following %}yup{% endif %}'
     self.assertEqual(render(src, user=self.user4, group=self.group), 'yup')
     self.assertEqual(render(src, user=self.user1, group=self.group), '')
コード例 #13
0
 def test_is_following_filter(self):
     src = '{% if user|is_following:group %}yup{% endif %}'
     self.assertEqual(render(src, user=self.user2, group=self.group), 'yup')
     self.assertEqual(render(src, user=self.user1, group=self.group), '')
コード例 #14
0
 def test_tag_display_action(self):
     src = '{% display_action action %}'
     output = render(src, action=self.join_action)
     self.assertAllIn([str(self.user1), 'joined', str(self.group)], output)
     src = '{% display_action action as nope %}'
     self.assertEqual(render(src, action=self.join_action), '')
コード例 #15
0
 def test_is_following_tag_with_verb_variable(self):
     src = '{% is_following user group verb as is_following %}' \
           '{% if is_following %}yup{% endif %}'
     self.assertEqual(render(src, user=self.user4, group=self.another_group, verb='liking'), 'yup')
     self.assertEqual(render(src, user=self.user1, group=self.another_group, verb='liking'), '')
コード例 #16
0
 def test_tag_actor_url(self):
     src = '{% actor_url user %}'
     output = render(src, user=self.user1)
     self.assertEqual(output, reverse('actstream_actor', args=(
         self.user_ct.pk, self.user1.pk)))
コード例 #17
0
 def test_tag_display_action(self):
     src = '{% display_action action %}'
     output = render(src, action=self.join_action)
     self.assertAllIn([str(self.user1), 'joined', str(self.group)], output)
     src = '{% display_action action as nope %}'
     self.assertEqual(render(src, action=self.join_action), '')
コード例 #18
0
 def test_is_following_tag_with_flag(self):
     src = '{% is_following user group "liking" as is_following %}' \
           '{% if is_following %}yup{% endif %}'
     self.assertEqual(render(src, user=self.user4, group=self.another_group), 'yup')
     self.assertEqual(render(src, user=self.user1, group=self.another_group), '')
コード例 #19
0
 def test_is_following_filter(self):
     src = '{% if user|is_following:group %}yup{% endif %}'
     self.assertEqual(render(src, user=self.user2, group=self.group), 'yup')
     self.assertEqual(render(src, user=self.user1, group=self.group), '')