def pre_save(self, obj): obj = super(OrgExtCRUDL.Edit, self).pre_save(obj) obj.set_banner_text(self.form.cleaned_data["banner_text"]) field_ids = self.form.cleaned_data["contact_fields"] Field.get_all(self.request.org).filter(pk__in=field_ids).update( is_visible=True) Field.get_all(self.request.org).exclude(pk__in=field_ids).update( is_visible=False) group_ids = self.form.cleaned_data["suspend_groups"] Group.get_all(self.request.org).filter(pk__in=group_ids).update( suspend_from=True) Group.get_all(self.request.org).exclude(pk__in=group_ids).update( suspend_from=False) followup_flow_uuid = self.form.cleaned_data["followup_flow"] if followup_flow_uuid: for flow in obj.get_backend().fetch_flows(obj): if flow.uuid == followup_flow_uuid: obj.set_followup_flow(flow) break else: obj.set_followup_flow(None) return obj
def pre_save(self, obj): obj = super(OrgExtCRUDL.Edit, self).pre_save(obj) obj.set_banner_text(self.form.cleaned_data['banner_text']) field_ids = self.form.cleaned_data['contact_fields'] Field.get_all(self.request.org).filter(pk__in=field_ids).update(is_visible=True) Field.get_all(self.request.org).exclude(pk__in=field_ids).update(is_visible=False) group_ids = self.form.cleaned_data['suspend_groups'] Group.get_all(self.request.org).filter(pk__in=group_ids).update(suspend_from=True) Group.get_all(self.request.org).exclude(pk__in=group_ids).update(suspend_from=False) return obj
def get_context_data(self, **kwargs): context = super(BaseInboxView, self).get_context_data(**kwargs) org = self.request.org user = self.request.user partner = user.get_partner(org) labels = list(Label.get_all(org, user).order_by("name")) Label.bulk_cache_initialize(labels) fields = Field.get_all(org, visible=True).order_by("label") # angular app requires context data in JSON format context["context_data_json"] = json_encode({ "user": { "id": user.pk, "partner": partner.as_json() if partner else None }, "labels": [l.as_json() for l in labels], "fields": [f.as_json() for f in fields], }) context["banner_text"] = org.get_banner_text() context["folder"] = self.folder.name context["folder_icon"] = self.folder_icon context["open_case_count"] = Case.get_open(org, user).count() context["closed_case_count"] = Case.get_closed(org, user).count() context["allow_case_without_message"] = getattr( settings, "SITE_ALLOW_CASE_WITHOUT_MESSAGE", False) context[ "user_must_reply_with_faq"] = org and not user.is_anonymous and user.must_use_faq( ) context["site_contact_display"] = getattr(settings, "SITE_CONTACT_DISPLAY", "name") return context
def render_search(self, book, search): from casepro.contacts.models import Field base_fields = [ "Message On", "Opened On", "Closed On", "Assigned Partner", "Labels", "Summary", "Messages Sent", "Messages Received", "Contact", ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Case.search(self.org, self.created_by, search) items = items.select_related("initial_message") # need for "Message On" items = items.annotate( incoming_count=Count("incoming_messages", distinct=True), outgoing_count=Count("outgoing_messages", distinct=True), ) def add_sheet(num): sheet = book.add_sheet(str(_("Cases %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.initial_message.created_on if item.initial_message else "", item.opened_on, item.closed_on, item.assignee.name, ", ".join([l.name for l in item.labels.all()]), item.summary, item.outgoing_count, # subtract 1 for the initial messages item.incoming_count - 1 if item.initial_message else item.incoming_count, item.contact.uuid, ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def __init__(self, *args, **kwargs): org = kwargs.pop("org") super(OrgEditForm, self).__init__(*args, **kwargs) self.fields["banner_text"].initial = org.get_banner_text() field_choices = [] for field in Field.objects.filter(org=org, is_active=True).order_by("label"): field_choices.append((field.pk, "%s (%s)" % (field.label, field.key))) self.fields["contact_fields"].choices = field_choices self.fields["contact_fields"].initial = [f.pk for f in Field.get_all(org, visible=True)] group_choices = [] for group in Group.get_all(org, dynamic=False).order_by("name"): group_choices.append((group.pk, group.name)) self.fields["suspend_groups"].choices = group_choices self.fields["suspend_groups"].initial = [g.pk for g in Group.get_suspend_from(org)] flow_choices = [("", "----")] for flow in org.get_backend().fetch_flows(org): flow_choices.append((flow.uuid, flow.name)) flow_initial = org.get_followup_flow() self.fields["followup_flow"].choices = flow_choices if flow_initial: self.fields["followup_flow"].initial = flow_initial.uuid
def __init__(self, *args, **kwargs): org = kwargs.pop('org') super(OrgEditForm, self).__init__(*args, **kwargs) self.fields['banner_text'].initial = org.get_banner_text() field_choices = [] for field in Field.objects.filter(org=org, is_active=True).order_by('label'): field_choices.append( (field.pk, "%s (%s)" % (field.label, field.key))) self.fields['contact_fields'].choices = field_choices self.fields['contact_fields'].initial = [ f.pk for f in Field.get_all(org, visible=True) ] group_choices = [] for group in Group.get_all(org, dynamic=False).order_by('name'): group_choices.append((group.pk, group.name)) self.fields['suspend_groups'].choices = group_choices self.fields['suspend_groups'].initial = [ g.pk for g in Group.get_suspend_from(org) ]
def render_book(self, book, search): from casepro.contacts.models import Field base_fields = [ "Message On", "Opened On", "Closed On", "Assigned Partner", "Labels", "Summary", "Messages Sent", "Messages Received", "Contact" ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported cases = Case.search(self.org, self.created_by, search) cases = cases.select_related('initial_message') # need for "Message On" cases = cases.annotate( incoming_count=Count('incoming_messages', distinct=True), outgoing_count=Count('outgoing_messages', distinct=True) ) def add_sheet(num): sheet = book.add_sheet(unicode(_("Cases %d" % num))) for col in range(len(all_fields)): field = all_fields[col] sheet.write(0, col, unicode(field)) return sheet # even if there are no cases - still add a sheet if not cases: add_sheet(1) else: sheet_number = 1 for case_chunk in chunks(cases, 65535): current_sheet = add_sheet(sheet_number) row = 1 for case in case_chunk: current_sheet.write(row, 0, self.excel_datetime(case.initial_message.created_on), self.DATE_STYLE) current_sheet.write(row, 1, self.excel_datetime(case.opened_on), self.DATE_STYLE) current_sheet.write(row, 2, self.excel_datetime(case.closed_on), self.DATE_STYLE) current_sheet.write(row, 3, case.assignee.name, self.DATE_STYLE) current_sheet.write(row, 4, ', '.join([l.name for l in case.labels.all()])) current_sheet.write(row, 5, case.summary) current_sheet.write(row, 6, case.outgoing_count) current_sheet.write(row, 7, case.incoming_count - 1) # subtract 1 for the initial messages current_sheet.write(row, 8, case.contact.uuid) fields = case.contact.get_fields() for cf in range(len(contact_fields)): contact_field = contact_fields[cf] current_sheet.write(row, len(base_fields) + cf, fields.get(contact_field.key, None)) row += 1 sheet_number += 1 return book
def __init__(self, *args, **kwargs): org = kwargs.pop('org') org_fields = Field.get_all(org).order_by('label') fields = ( forms.ModelChoiceField(queryset=org_fields, required=False, to_field_name='key'), forms.CharField(max_length=64) ) super(FieldTestField, self).__init__(fields, *args, **kwargs) self.widget = FieldTestWidget([fields[0].widget, fields[1].widget])
def render_search(self, book, search): from casepro.contacts.models import Field base_fields = [ "Message On", "Opened On", "Closed On", "Assigned Partner", "Labels", "Summary", "Messages Sent", "Messages Received", "Contact" ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Case.search(self.org, self.created_by, search) items = items.select_related('initial_message') # need for "Message On" items = items.annotate( incoming_count=Count('incoming_messages', distinct=True), outgoing_count=Count('outgoing_messages', distinct=True) ) def add_sheet(num): sheet = book.add_sheet(six.text_type(_("Cases %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.initial_message.created_on if item.initial_message else '', item.opened_on, item.closed_on, item.assignee.name, ', '.join([l.name for l in item.labels.all()]), item.summary, item.outgoing_count, # subtract 1 for the initial messages item.incoming_count - 1 if item.initial_message else item.incoming_count, item.contact.uuid ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def __init__(self, *args, **kwargs): org = kwargs.pop('org') org_fields = Field.get_all(org).order_by('label') fields = (forms.ModelChoiceField(queryset=org_fields, required=False, to_field_name='key'), forms.CharField(max_length=64)) super(FieldTestField, self).__init__(fields, *args, **kwargs) self.widget = FieldTestWidget([fields[0].widget, fields[1].widget])
def test_edit(self): url = reverse('orgs_ext.org_edit') self.login(self.admin) response = self.url_get('unicef', url) self.assertEqual(response.status_code, 200) form = response.context['form'] self.assertEqual(form.initial['name'], "UNICEF") self.assertEqual(form.initial['timezone'], pytz.timezone("Africa/Kampala")) self.assertEqual(form.fields['banner_text'].initial, "Howdy (U)Partner!") self.assertEqual(form.fields['contact_fields'].choices, [(self.age.pk, "Age (age)"), (self.nickname.pk, "Nickname (nickname)"), (self.state.pk, "State (state)")]) self.assertEqual(set(form.fields['contact_fields'].initial), {self.age.pk, self.nickname.pk}) self.assertEqual(form.fields['suspend_groups'].choices, [(self.females.pk, "Females"), (self.males.pk, "Males"), (self.reporters.pk, "Reporters")]) self.assertEqual(form.fields['suspend_groups'].initial, [self.reporters.pk]) # test updating response = self.url_post( 'unicef', url, { 'name': "UNIZEFF", 'timezone': "Africa/Kigali", 'banner_text': "Chill", 'contact_fields': [self.state.pk], 'suspend_groups': [self.males.pk] }) self.assertEqual(response.status_code, 302) self.unicef.refresh_from_db() self.unicef._config = None self.assertEqual(self.unicef.name, "UNIZEFF") self.assertEqual(self.unicef.timezone, pytz.timezone("Africa/Kigali")) self.assertEqual(self.unicef.get_banner_text(), "Chill") self.assertEqual(set(Group.get_suspend_from(self.unicef)), {self.males}) self.assertEqual(set(Field.get_all(self.unicef, visible=True)), {self.state})
def render_search(self, book, search): base_fields = [ "Sent On", "User", "Message", "Delay", "Reply to", "Flagged", "Case Assignee", "Labels", "Contact", ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Outgoing.search_replies(self.org, self.created_by, search) def add_sheet(num): sheet = book.add_sheet(str(_("Replies %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.created_on, item.created_by.email, item.text, timesince(item.reply_to.created_on, now=item.created_on), item.reply_to.text, item.reply_to.is_flagged, item.case.assignee.name if item.case else "", ", ".join([l.name for l in item.reply_to.labels.all()]), item.contact.uuid, ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def __init__(self, *args, **kwargs): org = kwargs.pop("org") org_fields = Field.get_all(org).order_by("label") fields = ( forms.ModelChoiceField(queryset=org_fields, required=False, to_field_name="key"), forms.CharField(max_length=64), ) widgets = (fields[0].widget, fields[1].widget) super(FieldTestField, self).__init__(fields, *args, **kwargs) self.widget = FieldTestWidget(widgets)
def render_search(self, book, search): from casepro.contacts.models import Field base_fields = [ "Time", "Message ID", "Flagged", "Labels", "Text", "Contact" ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Message.search(self.org, self.created_by, search, all=True).prefetch_related( "contact", "labels", "case__assignee", "case__user_assignee") def add_sheet(num): sheet = book.add_sheet(str(_("Messages %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.created_on, item.backend_id, item.is_flagged, ", ".join([l.name for l in item.labels.all()]), item.text, item.contact.uuid, ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def __init__(self, *args, **kwargs): org = kwargs.pop('org') super(OrgEditForm, self).__init__(*args, **kwargs) self.fields['banner_text'].initial = org.get_banner_text() field_choices = [] for field in Field.objects.filter(org=org, is_active=True).order_by('label'): field_choices.append((field.pk, "%s (%s)" % (field.label, field.key))) self.fields['contact_fields'].choices = field_choices self.fields['contact_fields'].initial = [f.pk for f in Field.get_all(org, visible=True)] group_choices = [] for group in Group.get_all(org, dynamic=False).order_by('name'): group_choices.append((group.pk, group.name)) self.fields['suspend_groups'].choices = group_choices self.fields['suspend_groups'].initial = [g.pk for g in Group.get_suspend_from(org)]
def render_search(self, book, search): base_fields = [ "Sent On", "User", "Message", "Delay", "Reply to", "Flagged", "Case Assignee", "Labels", "Contact" ] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Outgoing.search_replies(self.org, self.created_by, search) def add_sheet(num): sheet = book.add_sheet(six.text_type(_("Replies %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.created_on, item.created_by.email, item.text, timesince(item.reply_to.created_on, now=item.created_on), item.reply_to.text, item.reply_to.is_flagged, item.case.assignee.name if item.case else "", ', '.join([l.name for l in item.reply_to.labels.all()]), item.contact.uuid ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def get_context_data(self, **kwargs): context = super(PartnerCRUDL.Read, self).get_context_data(**kwargs) fields = Field.get_all(self.object.org, visible=True).order_by("label") # angular app requires context data in JSON format context["context_data_json"] = { "partner": self.object.as_json(), "fields": [f.as_json() for f in fields] } user_partner = self.request.user.get_partner(self.object.org) context["can_manage"] = self.request.user.can_manage(self.object) context[ "can_view_replies"] = not user_partner or user_partner == self.object context["labels"] = self.object.get_labels() context["summary"] = self.get_summary(self.object) return context
def get_context_data(self, **kwargs): context = super(PartnerCRUDL.Read, self).get_context_data(**kwargs) fields = Field.get_all(self.object.org, visible=True).order_by('label') # angular app requires context data in JSON format context['context_data_json'] = json_encode({ 'partner': self.object.as_json(), 'fields': [f.as_json() for f in fields] }) user_partner = self.request.user.get_partner(self.object.org) context['can_manage'] = self.request.user.can_manage(self.object) context[ 'can_view_replies'] = not user_partner or user_partner == self.object context['labels'] = self.object.get_labels() context['summary'] = self.get_summary(self.object) return context
def get_context_data(self, **kwargs): context = super(CaseCRUDL.Read, self).get_context_data(**kwargs) case = self.get_object() can_update = case.access_level( self.request.user) == AccessLevel.update labels = Label.get_all(self.request.org).order_by("name") fields = Field.get_all(self.object.org, visible=True).order_by("label") # angular app requires context data in JSON format context["context_data_json"] = { "all_labels": [l.as_json() for l in labels], "fields": [f.as_json() for f in fields], } context["can_update"] = can_update context["alert"] = self.request.GET.get("alert", None) context["case_id"] = case.id return context
def test_edit(self): url = reverse('orgs_ext.org_edit') self.login(self.admin) response = self.url_get('unicef', url) self.assertEqual(response.status_code, 200) form = response.context['form'] self.assertEqual(form.initial['name'], "UNICEF") self.assertEqual(form.initial['timezone'], "Africa/Kampala") self.assertEqual(form.fields['banner_text'].initial, "Howdy (U)Partner!") self.assertEqual(form.fields['contact_fields'].choices, [(self.age.pk, "Age (age)"), (self.nickname.pk, "Nickname (nickname)"), (self.state.pk, "State (state)")]) self.assertEqual(set(form.fields['contact_fields'].initial), {self.age.pk, self.nickname.pk}) self.assertEqual(form.fields['suspend_groups'].choices, [(self.females.pk, "Females"), (self.males.pk, "Males"), (self.reporters.pk, "Reporters")]) self.assertEqual(form.fields['suspend_groups'].initial, [self.reporters.pk]) # test updating response = self.url_post('unicef', url, { 'name': "UNIZEFF", 'timezone': "Africa/Kigali", 'banner_text': "Chill", 'contact_fields': [self.state.pk], 'suspend_groups': [self.males.pk] }) self.assertEqual(response.status_code, 302) self.unicef.refresh_from_db() self.unicef._config = None self.assertEqual(self.unicef.name, "UNIZEFF") self.assertEqual(self.unicef.timezone, "Africa/Kigali") self.assertEqual(self.unicef.get_banner_text(), "Chill") self.assertEqual(set(Group.get_suspend_from(self.unicef)), {self.males}) self.assertEqual(set(Field.get_all(self.unicef, visible=True)), {self.state})
def render_search(self, book, search): from casepro.contacts.models import Field base_fields = ["Time", "Message ID", "Flagged", "Labels", "Text", "Contact"] contact_fields = Field.get_all(self.org, visible=True) all_fields = base_fields + [f.label for f in contact_fields] # load all messages to be exported items = Message.search(self.org, self.created_by, search) def add_sheet(num): sheet = book.add_sheet(six.text_type(_("Messages %d" % num))) self.write_row(sheet, 0, all_fields) return sheet sheet = None sheet_number = 0 row = 1 for item in items: if not sheet or row > self.MAX_SHEET_ROWS: sheet_number += 1 sheet = add_sheet(sheet_number) row = 1 values = [ item.created_on, item.backend_id, item.is_flagged, ', '.join([l.name for l in item.labels.all()]), item.text, item.contact.uuid ] fields = item.contact.get_fields() for field in contact_fields: values.append(fields.get(field.key, "")) self.write_row(sheet, row, values) row += 1
def get_context_data(self, **kwargs): context = super(CaseCRUDL.Read, self).get_context_data(**kwargs) case = self.get_object() can_update = case.access_level( self.request.user) == AccessLevel.update labels = Label.get_all(self.request.org).order_by('name') fields = Field.get_all(self.object.org, visible=True).order_by('label') # angular app requires context data in JSON format context['context_data_json'] = json_encode({ 'all_labels': [l.as_json() for l in labels], 'fields': [f.as_json() for f in fields], }) context['can_update'] = can_update context['alert'] = self.request.GET.get('alert', None) context['case_id'] = case.id context['pods'] = pod_registry.pods context['pod_types'] = pod_registry.pod_types return context
def get_context_data(self, **kwargs): context = super(BaseInboxView, self).get_context_data(**kwargs) org = self.request.org user = self.request.user partner = user.get_partner(org) labels = list(Label.get_all(org, user).order_by('name')) Label.bulk_cache_initialize(labels) groups = Group.get_all(org, visible=True).order_by('name') fields = Field.get_all(org, visible=True).order_by('label') # angular app requires context data in JSON format context['context_data_json'] = json_encode({ 'user': { 'id': user.pk, 'partner': partner.as_json() if partner else None }, 'labels': [l.as_json() for l in labels], 'groups': [g.as_json() for g in groups], 'fields': [f.as_json() for f in fields], }) context['banner_text'] = org.get_banner_text() context['folder'] = self.folder.name context['folder_icon'] = self.folder_icon context['open_case_count'] = Case.get_open(org, user).count() context['closed_case_count'] = Case.get_closed(org, user).count() context['allow_case_without_message'] = getattr( settings, 'SITE_ALLOW_CASE_WITHOUT_MESSAGE', False) context['user_must_reply_with_faq'] = org and not user.is_anonymous( ) and user.must_use_faq() context['site_contact_display'] = getattr(settings, 'SITE_CONTACT_DISPLAY', "name") return context
def get_contact_fields(self, obj): return ', '.join([f.key for f in Field.get_all(obj, visible=True)])
def test_edit(self, mock_fetch_flows): mock_fetch_flows.return_value = [ Flow("0001-0001", "Registration"), Flow("0002-0002", "Follow-Up") ] url = reverse("orgs_ext.org_edit") self.login(self.admin) response = self.url_get("unicef", url) self.assertEqual(response.status_code, 200) form = response.context["form"] self.assertEqual(form.initial["name"], "UNICEF") self.assertEqual(form.initial["timezone"], pytz.timezone("Africa/Kampala")) self.assertEqual(form.fields["banner_text"].initial, "Howdy (U)Partner!") self.assertEqual( form.fields["contact_fields"].choices, [(self.age.pk, "Age (age)"), (self.nickname.pk, "Nickname (nickname)"), (self.state.pk, "State (state)")], ) self.assertEqual(set(form.fields["contact_fields"].initial), {self.age.pk, self.nickname.pk}) self.assertEqual( form.fields["suspend_groups"].choices, [(self.females.pk, "Females"), (self.males.pk, "Males"), (self.reporters.pk, "Reporters")], ) self.assertEqual(form.fields["suspend_groups"].initial, [self.reporters.pk]) self.assertEqual( form.fields["followup_flow"].choices, [("", "----"), ("0001-0001", "Registration"), ("0002-0002", "Follow-Up")], ) self.assertEqual(form.fields["followup_flow"].initial, None) # test updating response = self.url_post( "unicef", url, { "name": "UNIZEFF", "timezone": "Africa/Kigali", "banner_text": "Chill", "contact_fields": [self.state.pk], "suspend_groups": [self.males.pk], "followup_flow": "0002-0002", }, ) self.assertEqual(response.status_code, 302) self.unicef.refresh_from_db() self.unicef._config = None self.assertEqual(self.unicef.name, "UNIZEFF") self.assertEqual(self.unicef.timezone, pytz.timezone("Africa/Kigali")) self.assertEqual(self.unicef.get_banner_text(), "Chill") self.assertEqual(self.unicef.get_followup_flow(), Flow("0002-0002", "Follow-Up")) self.assertEqual(set(Group.get_suspend_from(self.unicef)), {self.males}) self.assertEqual(set(Field.get_all(self.unicef, visible=True)), {self.state}) # open the form again response = self.url_get("unicef", url) self.assertEqual(response.status_code, 200) form = response.context["form"] self.assertEqual(form.fields["followup_flow"].initial, "0002-0002") # test clearing things response = self.url_post( "unicef", url, { "name": "UNIZEFF", "timezone": "Africa/Kigali", "banner_text": "", "contact_fields": [], "suspend_groups": [], "followup_flow": "", }, ) self.assertEqual(response.status_code, 302) self.unicef.refresh_from_db() self.unicef._config = None self.assertIsNone(self.unicef.get_followup_flow())