File tree 1 file changed +9
-3
lines changed
readthedocs/rtd_tests/tests 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -82,18 +82,24 @@ def test_https(self):
82
82
self .assertFalse (form .is_valid ())
83
83
84
84
def test_canonical_change (self ):
85
- """Make sure https is an admin-only attribute """
85
+ """Make sure canonical can be properly changed """
86
86
form = DomainForm ({'domain' : 'example.com' , 'canonical' : True },
87
87
project = self .project )
88
88
self .assertTrue (form .is_valid ())
89
89
domain = form .save ()
90
- self .assertTrue (domain .canonical , 'example.com' )
90
+ self .assertEqual (domain .domain , 'example.com' )
91
91
92
92
form = DomainForm ({'domain' : 'example2.com' , 'canonical' : True },
93
93
project = self .project )
94
+ self .assertFalse (form .is_valid ())
95
+ self .assertEqual (form .errors ['canonical' ][0 ], 'Only 1 Domain can be canonical at a time.' )
96
+
97
+ form = DomainForm ({'domain' : 'example2.com' , 'canonical' : True },
98
+ project = self .project ,
99
+ instance = domain )
94
100
self .assertTrue (form .is_valid ())
95
101
domain = form .save ()
96
- self .assertTrue (domain .canonical , 'example2.com' )
102
+ self .assertEqual (domain .domain , 'example2.com' )
97
103
98
104
99
105
class TestAPI (TestCase ):
You can’t perform that action at this time.
0 commit comments