1
+ import pytest
2
+ from grants .tests .factories .grant_hall_of_fame_factory import GrantHallOfFameFactory , GrantHallOfFameGranteeFactory
3
+ from grants .models .hall_of_fame import GrantHallOfFame , GrantHallOfFameGrantee
4
+
5
+
6
+ @pytest .mark .django_db
7
+ class TestGrantHallOfFame :
8
+ """Test GrantHallOfFame class in GrantHallOfFame model."""
9
+
10
+ def test_creation (self ):
11
+ """Test GrantHallOfFame data returned by factory is valid."""
12
+
13
+ grant_hall_of_fame = GrantHallOfFameFactory ()
14
+
15
+ assert isinstance (grant_hall_of_fame , GrantHallOfFame )
16
+
17
+ def test_grant_hall_of_fame_has_total_donations (self ):
18
+ grant_hall_of_fame = GrantHallOfFameFactory ()
19
+
20
+ assert hasattr (grant_hall_of_fame , 'total_donations' )
21
+
22
+ def test_grant_hall_of_fame_has_top_matching_partners (self ):
23
+ grant_hall_of_fame = GrantHallOfFameFactory ()
24
+
25
+ assert hasattr (grant_hall_of_fame , 'top_matching_partners' )
26
+
27
+ def test_grant_hall_of_fame_has_top_matching_partners_mobile_attribute (self ):
28
+ grant_hall_of_fame = GrantHallOfFameFactory ()
29
+
30
+ assert hasattr (grant_hall_of_fame , 'top_matching_partners_mobile' )
31
+
32
+ def test_grant_hall_of_fame_has_top_individual_donors (self ):
33
+ grant_hall_of_fame = GrantHallOfFameFactory ()
34
+
35
+ assert hasattr (grant_hall_of_fame , 'top_individual_donors' )
36
+
37
+ def test_grant_hall_of_fame_has_top_individual_donors_mobile (self ):
38
+ grant_hall_of_fame = GrantHallOfFameFactory ()
39
+
40
+ assert hasattr (grant_hall_of_fame , 'top_individual_donors_mobile' )
41
+
42
+ def test_grant_hall_of_fame_has_graduated_grantees_description (self ):
43
+ grant_hall_of_fame = GrantHallOfFameFactory ()
44
+
45
+ assert hasattr (grant_hall_of_fame , 'graduated_grantees_description' )
46
+
47
+ def test_grant_hall_of_fame_has_share_your_story_email (self ):
48
+ grant_hall_of_fame = GrantHallOfFameFactory ()
49
+
50
+ assert hasattr (grant_hall_of_fame , 'share_your_story_email' )
51
+
52
+ def test_grant_has_is_published_attribute (self ):
53
+ grant_hall_of_fame = GrantHallOfFameFactory ()
54
+
55
+ assert hasattr (grant_hall_of_fame , 'is_published' )
56
+ assert grant_hall_of_fame .is_published == False
57
+
58
+ @pytest .mark .django_db
59
+ class TestGrantHallOfFameGrantee :
60
+ """Test GrantHallOfFameGrantee class in GrantHallOfFame model."""
61
+
62
+ def test_creation (self ):
63
+ """Test GrantHallOfFameGrantee data returned by factory is valid."""
64
+
65
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
66
+
67
+ assert isinstance (grant_hall_of_fame_grantee , GrantHallOfFameGrantee )
68
+
69
+ def test_grant_hall_of_fame_grantee_has_associated_hall_of_fame (self ):
70
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
71
+
72
+ assert hasattr (grant_hall_of_fame_grantee , 'hall_of_fame' )
73
+
74
+ def test_grant_hall_of_fame_grantee_has_grantee (self ):
75
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
76
+
77
+ assert hasattr (grant_hall_of_fame_grantee , 'grantee' )
78
+
79
+ def test_grant_hall_of_fame_grantee_has_a_name (self ):
80
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
81
+
82
+ assert hasattr (grant_hall_of_fame_grantee , 'name' )
83
+
84
+ def test_grant_hall_of_fame_grantee_has_funded_by_attribute (self ):
85
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
86
+
87
+ assert hasattr (grant_hall_of_fame_grantee , 'funded_by' )
88
+
89
+ def test_grant_hall_of_fame_grantee_has_an_amount (self ):
90
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
91
+
92
+ assert hasattr (grant_hall_of_fame_grantee , 'amount' )
93
+
94
+ def test_grant_hall_of_fame_grantee_has_a_description (self ):
95
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
96
+
97
+ assert hasattr (grant_hall_of_fame_grantee , 'description' )
98
+
99
+ def test_grant_hall_of_fame_grantee_has_accomplishment_1 (self ):
100
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
101
+
102
+ assert hasattr (grant_hall_of_fame_grantee , 'accomplishment_1' )
103
+
104
+ def test_grant_hall_of_fame_grantee_has_accomplishment_2 (self ):
105
+ grant_hall_of_fame_grantee = GrantHallOfFameGranteeFactory ()
106
+
107
+ assert hasattr (grant_hall_of_fame_grantee , 'accomplishment_2' )
0 commit comments