Completed
Pull Request — master (#390)
by
unknown
23s
created

CustomModelTests.test_custom_action_model()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
1
from django.test.utils import override_settings
2
3
from actstream import get_action_model, get_follow_model
4
from actstream.signals import action
5
from actstream.tests.base import ActivityBaseTestCase
6
7
from .models import CustomAction, CustomFollow
8
9
10
@override_settings(
11
    ACTSTREAM_ACTION_MODEL='custom.CustomAction',
12
    ACTSTREAM_FOLLOW_MODEL='custom.CustomFollow'
13
)
14
class CustomModelTests(ActivityBaseTestCase):
15
    def setUp(self):
16
        super(CustomModelTests, self).setUp()
17
        self.user = self.User.objects.create(username='test')
18
19
    def test_custom_action_model(self):
20
        self.assertEqual(get_action_model(), CustomAction)
21
22
    def test_custom_follow_model(self):
23
        self.assertEqual(get_follow_model(), CustomFollow)
24
25
    def test_custom_data(self):
26
        """Adding custom data to a model field works as expected."""
27
        action.send(self.user, verb='was created', quest='to be awesome')
28
        self.assertEqual(CustomAction.objects.count(), 1)
29
        self.assertEqual(CustomAction.objects.first().quest, 'to be awesome')
30