5
5
6
6
from temba .channels .models import ChannelLog
7
7
from temba .flows .models import Flow
8
- from temba .msgs .models import Msg , SystemLabel
8
+ from temba .msgs .models import Msg , MsgFolder
9
9
from temba .msgs .tasks import fail_old_android_messages
10
10
from temba .tests import CRUDLTestMixin , TembaTest
11
11
from temba .tickets .models import Ticket
@@ -175,7 +175,7 @@ def test_archive_and_release(self):
175
175
def test_release_counts (self ):
176
176
flow = self .create_flow ("Test" )
177
177
178
- def assertReleaseCount (direction , status , visibility , flow , label ):
178
+ def assertReleaseCount (direction , status , visibility , flow , folder ):
179
179
if direction == Msg .DIRECTION_OUT :
180
180
msg = self .create_outgoing_msg (self .joe , "Whattup Joe" , flow = flow , status = status )
181
181
else :
@@ -184,23 +184,23 @@ def assertReleaseCount(direction, status, visibility, flow, label):
184
184
Msg .objects .filter (id = msg .id ).update (visibility = visibility )
185
185
186
186
# assert our folder count is right
187
- counts = SystemLabel .get_counts (self .org )
188
- self .assertEqual (counts [label ], 1 )
187
+ counts = MsgFolder .get_counts (self .org )
188
+ self .assertEqual (counts [folder ], 1 )
189
189
190
190
# delete the msg, count should now be 0
191
191
msg .delete ()
192
- counts = SystemLabel .get_counts (self .org )
193
- self .assertEqual (counts [label ], 0 )
192
+ counts = MsgFolder .get_counts (self .org )
193
+ self .assertEqual (counts [folder ], 0 )
194
194
195
195
# outgoing labels
196
- assertReleaseCount ("O" , Msg .STATUS_SENT , Msg .VISIBILITY_VISIBLE , None , SystemLabel . TYPE_SENT )
197
- assertReleaseCount ("O" , Msg .STATUS_QUEUED , Msg .VISIBILITY_VISIBLE , None , SystemLabel . TYPE_OUTBOX )
198
- assertReleaseCount ("O" , Msg .STATUS_FAILED , Msg .VISIBILITY_VISIBLE , flow , SystemLabel . TYPE_FAILED )
196
+ assertReleaseCount ("O" , Msg .STATUS_SENT , Msg .VISIBILITY_VISIBLE , None , MsgFolder . SENT )
197
+ assertReleaseCount ("O" , Msg .STATUS_QUEUED , Msg .VISIBILITY_VISIBLE , None , MsgFolder . OUTBOX )
198
+ assertReleaseCount ("O" , Msg .STATUS_FAILED , Msg .VISIBILITY_VISIBLE , flow , MsgFolder . FAILED )
199
199
200
200
# incoming labels
201
- assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_VISIBLE , None , SystemLabel . TYPE_INBOX )
202
- assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_ARCHIVED , None , SystemLabel . TYPE_ARCHIVED )
203
- assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_VISIBLE , flow , SystemLabel . TYPE_FLOWS )
201
+ assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_VISIBLE , None , MsgFolder . INBOX )
202
+ assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_ARCHIVED , None , MsgFolder . ARCHIVED )
203
+ assertReleaseCount ("I" , Msg .STATUS_HANDLED , Msg .VISIBILITY_VISIBLE , flow , MsgFolder . HANDLED )
204
204
205
205
def test_fail_old_android_messages (self ):
206
206
msg1 = self .create_outgoing_msg (self .joe , "Hello" , status = Msg .STATUS_QUEUED )
0 commit comments