File tree 2 files changed +25
-3
lines changed
src/open_inwoner/accounts
2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,23 @@ def test_reply_message(self):
158
158
self .assertEqual (last_message .sender , self .contact1 )
159
159
self .assertEqual (last_message .receiver , self .user )
160
160
161
+ def test_no_messages (self ):
162
+ Message .objects .all ().delete ()
163
+
164
+ response = self .app .get (self .url , auto_follow = True )
165
+ self .assertEqual (response .status_code , 200 )
166
+ # no form
167
+ self .assertFalse (response .pyquery ("form#message-form" ))
168
+
169
+ def test_no_contacts (self ):
170
+ self .contact1 .delete ()
171
+ self .contact2 .delete ()
172
+
173
+ response = self .app .get (self .url , auto_follow = True )
174
+ self .assertEqual (response .status_code , 200 )
175
+ # no form
176
+ self .assertFalse (response .pyquery ("form#message-form" ))
177
+
161
178
162
179
class BaseInboxPageSeleniumTests :
163
180
options = None
Original file line number Diff line number Diff line change @@ -40,13 +40,18 @@ def get_context_data(self, **kwargs):
40
40
messages = self .get_messages (other_user )
41
41
status = self .get_status (messages )
42
42
43
+ if other_user :
44
+ conversation_url = reverse (
45
+ "accounts:inbox" , kwargs = {self .slug_field : other_user .uuid }
46
+ )
47
+ else :
48
+ conversation_url = ""
49
+
43
50
context .update (
44
51
{
45
52
"conversations" : conversations ,
46
53
"conversation_messages" : messages ,
47
- "conversation_url" : reverse (
48
- "accounts:inbox" , kwargs = {self .slug_field : other_user .uuid }
49
- ),
54
+ "conversation_url" : conversation_url ,
50
55
"other_user" : other_user ,
51
56
"status" : status ,
52
57
}
You can’t perform that action at this time.
0 commit comments