Example #1
0
 def test_search_only_includes_articles(self):
     self.backend = get_search_backend('default')
     self.backend.reset_index()
     self.mk_articles(self.english_section, count=2)
     footer = FooterPage(title='Test Footer')
     self.footer_index.add_child(instance=footer)
     footer.save_revision().publish()
     self.backend.refresh_index()
     response = self.client.get(reverse('search'), {
         'q': 'Test'
     })
     results = response.context['results']
     for article in results:
         self.assertNotEqual(article.title, 'Test Footer')
Example #2
0
 def test_search_only_includes_articles(self):
     self.backend = get_search_backend('default')
     self.backend.reset_index()
     self.mk_articles(self.english_section, count=2)
     footer = FooterPage(title='Test Footer')
     self.footer_index.add_child(instance=footer)
     footer.save_revision().publish()
     self.backend.refresh_index()
     response = self.client.get(reverse('search'), {
         'q': 'Test'
     })
     results = response.context['results']
     for article in results:
         self.assertNotEqual(article.title, 'Test Footer')
    def test_tag_nav_data_does_not_pull_in_footer_pages(self):
        self.mk_articles(parent=self.yourmind, count=2)
        footer = FooterPage(title='Test Footer Page')
        self.footer_index.add_child(instance=footer)
        footer.save_revision().publish()
        footer2 = FooterPage(title='Test Footer Page 2')
        self.footer_index.add_child(instance=footer2)
        footer2.save_revision().publish()
        footer3 = FooterPage(title='Test Footer Page 3')
        self.footer_index.add_child(instance=footer3)
        footer3.save_revision().publish()
        footer_pks = [footer.pk, footer2.pk, footer3.pk]

        response = self.client.get('/')
        data = response.context['tag_nav_data']
        hoempage_articles = []
        for section, section_list in data['sections']:
            homepage_articles = list(chain(hoempage_articles, section_list))
        for tag, tag_list in data['tags_list']:
            homepage_articles = list(chain(homepage_articles, tag_list))
        homepage_articles = list(chain(
            homepage_articles, data['latest_articles']))
        for article in homepage_articles:
            self.assertFalse(article.pk in footer_pks)
Example #4
0
    def handle(self, *args, **options):
        for main in Main.objects.all():
            print(
                "*" * 10,
                "Migrating Surveys in",
                main,
                "*" * 10,
            )
            surveys_index = SurveysIndexPage.objects.child_of(main).first()
            forms_index = FormsIndexPage.objects.descendant_of(main).filter(
                slug='surveys-indexpage').first()
            surveys_tc = TermsAndConditionsIndexPage.objects.child_of(
                surveys_index).first()

            # Copy the Survey Ts&Cs to Forms
            if surveys_tc:
                forms_tc = FormsTermsAndConditionsIndexPage.objects.filter(
                    slug='terms-conditions-indexpage').child_of(
                        forms_index).first()
                forms_index.add_child(instance=forms_tc)
                forms_tc.save_revision().publish()
                for footerpage in FooterPage.objects.child_of(surveys_tc):
                    footer_dict = {}
                    exclude = (
                        '_state',
                        'id',
                        'path',
                        'numchild',
                        'page_ptr_id',
                        'content_type_id',
                        'articlepage_ptr_id',
                        '_language_cache',
                    )
                    for item in footerpage.__dict__.items():
                        if item[0] not in exclude:
                            footer_dict[item[0]] = item[1]

                    footer_page = FooterPage(**footer_dict)
                    forms_tc.add_child(instance=footer_page)
                    if footerpage.status_string == 'draft' \
                            or footerpage.status_string == 'expired':
                        footer_page.specific.unpublish()
                    else:
                        footer_page.save_revision().publish()
            print("Copying of Survey Ts&Cs is Done")

            # Migrate Survey Page to Form Page
            translated_survey = {}
            for survey in MoloSurveyPage.objects.descendant_of(
                    surveys_index).exact_type(MoloSurveyPage):
                if survey.language.is_main_language and\
                     survey.translated_pages.first():
                    translated_survey[survey.slug] = \
                        survey.translated_pages.first().slug

                survey_dict = {}
                exclude = ('_state', 'id', 'path', 'numchild', 'page_ptr_id',
                           'content_type_id', 'landing_page_template',
                           '_language_cache')
                for item in survey.__dict__.items():
                    if item[0] not in exclude:
                        survey_dict[item[0]] = item[1]

                survey_id = survey.id
                survey_dict['slug'] = "form-" + survey_dict['slug']
                survey_dict['display_form_directly'] = survey_dict[
                    'display_survey_directly']
                del survey_dict['display_survey_directly']

                form = MoloFormPage(**survey_dict)
                forms_index.add_child(instance=form)
                if survey.status_string == 'draft'\
                        or survey.status_string == 'expired':
                    form.specific.unpublish()
                else:
                    form.save_revision().publish()

                if survey.terms_and_conditions.first():
                    form_tc = FooterPage.objects.child_of(forms_tc).filter(
                        title=survey.terms_and_conditions.first(
                        ).terms_and_conditions.title)
                    survey.terms_and_conditions.first().terms_and_conditions
                    FormTermsConditions.objects.create(
                        page=form, terms_and_conditions=form_tc.first())

                for form_field in MoloSurveyFormField.objects.filter(
                        page_id=survey_id):
                    form_field_dict = {}
                    for item in form_field.__dict__.items():
                        form_field_dict[item[0]] = item[1]
                    form_field_dict['page_id'] = form.id
                    del form_field_dict['_state']
                    del form_field_dict['id']

                    MoloFormField.objects.create(**form_field_dict)

                for submission in MoloSurveySubmission.objects.filter(
                        page_id=survey_id):
                    submission_dict = {}
                    for item in submission.__dict__.items():
                        submission_dict[item[0]] = item[1]

                    del submission_dict['_state']
                    del submission_dict['id']
                    submission_dict['submit_time'] = submission_dict[
                        'created_at']
                    del submission_dict['created_at']
                    submission_dict['page_id'] = form.id
                    form_submission = MoloFormSubmission.objects.create(
                        **submission_dict)
                    form_submission.submit_time =\
                        submission_dict['submit_time']
                    form_submission.save()

            for key in translated_survey:
                main_form = MoloFormPage.objects.descendant_of(
                    forms_index).get(slug="form-%s" % key).specific
                translated_form = MoloFormPage.objects.descendant_of(
                    forms_index).get(slug="form-%s" %
                                     translated_survey[key]).specific
                main_form.translated_pages.add(translated_form)
                translated_form.translated_pages.add(main_form)
            print("Migration of SurveyPage is Done")

            # Migrate Personalisable Survey to Form
            translated_survey = {}
            for personalisable_survey in \
                PersonalisableSurvey.objects.descendant_of(
                    surveys_index).exact_type(PersonalisableSurvey):
                if personalisable_survey.language.is_main_language and \
                     personalisable_survey.translated_pages.first():
                    translated_survey[personalisable_survey.slug] = \
                        personalisable_survey.translated_pages.first().slug

                personalisable_survey_dict = {}
                exclude = ('_state', 'id', 'content_type_id',
                           'molosurveypage_ptr_id', 'numchild',
                           'landing_page_template', 'page_ptr_id',
                           '_language_cache')
                for item in personalisable_survey.__dict__.items():
                    if item[0] not in exclude:
                        personalisable_survey_dict[item[0]] = item[1]

                personalisable_survey_id = personalisable_survey.id
                personalisable_survey_dict['slug'] = \
                    "form-" + personalisable_survey_dict['slug']
                personalisable_survey_dict['display_form_directly'] \
                    = personalisable_survey_dict[
                        'display_survey_directly']
                del personalisable_survey_dict['display_survey_directly']

                personalisable_form = PersonalisableForm(
                    **personalisable_survey_dict)
                forms_index.add_child(instance=personalisable_form)
                if personalisable_survey.status_string == 'draft'\
                        or personalisable_survey.status_string == 'expired':
                    personalisable_form.specific.unpublish()
                else:
                    personalisable_form.save_revision().publish()

                if personalisable_survey.terms_and_conditions.first():
                    form_tc = FooterPage.objects.child_of(forms_tc).filter(
                        title=personalisable_survey.terms_and_conditions.first(
                        ).terms_and_conditions.title)
                    personalisable_survey.terms_and_conditions.first()\
                        .terms_and_conditions
                    FormTermsConditions.objects.create(
                        page=personalisable_form,
                        terms_and_conditions=form_tc.first())

                for personalisable_form_field in \
                    PersonalisableSurveyFormField.objects.filter(
                        page_id=personalisable_survey_id):
                    personalisable_form_field_dict = {}

                    for item in personalisable_form_field.__dict__.items():
                        personalisable_form_field_dict[item[0]] = item[1]
                    personalisable_form_field_dict[
                        'page_id'] = PersonalisableForm.objects.filter(
                            id=personalisable_form.id).first().id
                    del personalisable_form_field_dict['_state']
                    del personalisable_form_field_dict['id']

                    PersonalisableFormField.objects.create(
                        **personalisable_form_field_dict)
                for submission in \
                    MoloSurveySubmission.objects.filter(
                        page_id=personalisable_survey_id):
                    submission_dict = {}
                    for item in submission.__dict__.items():
                        submission_dict[item[0]] = item[1]
                    del submission_dict['_state']
                    del submission_dict['id']
                    submission_dict['submit_time'] = \
                        submission_dict['created_at']
                    del submission_dict['created_at']
                    submission_dict['page_id'] = personalisable_form.id
                    form_submission = MoloFormSubmission.objects.create(
                        **submission_dict)
                    form_submission.submit_time =\
                        submission_dict['submit_time']
                    form_submission.save()
            for key in translated_survey:
                main_form = PersonalisableForm.objects.descendant_of(
                    forms_index).get(slug="form-%s" % key).specific
                translated_form = PersonalisableForm.objects.descendant_of(
                    forms_index).get(slug="form-%s" %
                                     translated_survey[key]).specific
                main_form.translated_pages.add(translated_form)
                translated_form.translated_pages.add(main_form)
            print("Migration of Personalisable Survey is Done")

        # Migrate Survey User Group to Form
        for segment_user_group in SegmentUserGroup.objects.all():
            segment_user_group_dict = {}
            for item in segment_user_group.__dict__.items():
                segment_user_group_dict[item[0]] = item[1]
            del segment_user_group_dict['_state']
            del segment_user_group_dict['id']
            segment_user_group_dict['name'] = \
                "form-" + segment_user_group_dict['name']

            FormsSegmentUserGroup.objects.create(**segment_user_group_dict)
        print("Migration of User Group is Done")

        # Migrate Survey Page View
        for view in MoloSurveyPageView.objects.all().iterator():
            view_dict = {}
            for item in view.__dict__.items():
                if item[0] not in ('id', '_state'):
                    view_dict[item[0]] = item[1]
            form_page_view = MoloFormPageView(**view_dict)
            form_page_view.save()
            form_page_view.visited_at = view_dict["visited_at"]
            form_page_view.save()
        print("Migration of PageView is Done")

        # Migrate Survey Rules to Form
        for segment in Segment.objects.all().iterator():
            submission_rules = \
                SurveySubmissionDataRule.objects.filter(
                    segment_id=segment.id).all()
            for submission_rule in submission_rules:
                rule_dict = {}
                for item in submission_rule.__dict__.items():
                    if item[0] not in ('id', '_state'):
                        rule_dict[item[0]] = item[1]
                survey_slug = MoloSurveyPage.objects.filter(
                    id=rule_dict["survey_id"]).first().slug
                form_id = MoloFormPage.objects.filter(slug="form-" +
                                                      survey_slug).first().id
                rule_dict["form_id"] = form_id
                del rule_dict["survey_id"]
                FormSubmissionDataRule.objects.create(**rule_dict)
                submission_rule.delete()
                segment.save()

            response_rules = SurveyResponseRule.objects.filter(
                segment_id=segment.id).all()
            for response_rule in response_rules:
                rule_dict = {}
                for item in response_rule.__dict__.items():
                    if item[0] not in ('id', '_state'):
                        rule_dict[item[0]] = item[1]
                survey_slug = MoloSurveyPage.objects.filter(
                    id=rule_dict["survey_id"]).first().slug
                form_id = MoloFormPage.objects.filter(slug="form-" +
                                                      survey_slug).first().id
                rule_dict["form_id"] = form_id
                del rule_dict["survey_id"]
                FormResponseRule.objects.create(**rule_dict)
                response_rule.delete()
                segment.save()

            article_rules = ArticleTagRule.objects.filter(
                segment_id=segment.id).all()
            for article_rule in article_rules:
                rule_dict = {}
                for item in article_rule.__dict__.items():
                    if item[0] not in ('id', '_state'):
                        rule_dict[item[0]] = item[1]
                FormsArticleTagRule.objects.create(**rule_dict)
                article_rule.delete()
                segment.save()

            combination_rules = CombinationRule.objects.filter(
                segment_id=segment.id).all()
            for combination_rule in combination_rules:
                rule_dict = {}
                for item in combination_rule.__dict__.items():
                    if item[0] not in ('id', '_state'):
                        rule_dict[item[0]] = item[1]
                FormCombinationRule.objects.create(**rule_dict)
                combination_rule.delete()
                segment.save()

            group_rules = GroupMembershipRule.objects.filter(
                segment_id=segment.id).all()
            for group_rule in group_rules:
                rule_dict = {}
                for item in group_rule.__dict__.items():
                    if item[0] not in ('id', '_state'):
                        rule_dict[item[0]] = item[1]
                survey_group = SegmentUserGroup.objects.filter(
                    id=rule_dict["group_id"]).first()
                form_group = FormsSegmentUserGroup.objects.filter(
                    name="form-" + survey_group.name).first()
                rule_dict["group_id"] = form_group.id
                FormGroupMembershipRule.objects.create(**rule_dict)
                group_rule.delete()
                segment.save()
        print("Migration of Survey Rules to Form is Done")
        print("*" * 10, "Migration is Done", "*" * 10)
class TestCustomGemMiddleware(TestCase, GemTestCaseMixin):

    submit_tracking_method = (
        "gem.middleware.GemMoloGoogleAnalyticsMiddleware.submit_tracking"
    )

    def setUp(self):
        self.main = self.mk_main(
            title='main1', slug='main1', path='00010002', url_path='/main1/')
        self.client = Client(HTTP_HOST=self.main.get_site().hostname)

        self.site_settings = SiteSettings.for_site(self.main.get_site())
        self.site_settings.local_ga_tracking_code = 'local_ga_tracking_code'
        self.site_settings.save()

        GemSettings.objects.create(
            site_id=self.main.get_site().id,
            bbm_ga_account_subdomain='bbm',
            bbm_ga_tracking_code='bbm_tracking_code',
        )
        self.yourmind = self.mk_section(
            SectionIndexPage.objects.child_of(self.main).first(),
            title='Your mind')

        self.article = self.mk_article(
            self.yourmind, title='article',
            subtitle='article with nav_tags',
            slug='article')
        self.article.save_revision().publish()
        self.article2 = self.mk_article(
            self.yourmind, title='article2',
            subtitle='artitle without nav_tags',
            slug='article2')
        self.article2.save_revision().publish()

        self.tag_index = TagIndexPage.objects.child_of(self.main).first()
        self.tag = Tag(title='Tag1')
        self.tag2 = Tag(title='Tag2')
        self.tag_index.add_child(instance=self.tag)
        self.tag.save_revision().publish()
        self.tag_index.add_child(instance=self.tag2)
        self.tag2.save_revision().publish()

        self.article.nav_tags.create(tag=self.tag)
        self.article.save_revision().publish()
        self.article.nav_tags.create(tag=self.tag2)
        self.article.save_revision().publish()
        # get footerpage
        self.footer_index = FooterIndexPage.objects.child_of(self.main).first()
        self.footer = FooterPage(title='Test Footer Page')
        self.footer_index.add_child(instance=self.footer)
        self.footer.save_revision().publish()
        self.response = self.client.get('/')

    @patch(submit_tracking_method)
    def test_submit_to_additional_ga_account(self, mock_submit_tracking):
        '''
        Given that bbm_ga_account_subdomain and bbm_ga_tracking_code
        are set in Gem Settings, and the URL contains the
        bbm_ga_account_subdomain, info should be sent to
        the additional GA account.
        '''

        request = RequestFactory().get(
            '/',
            HTTP_HOST='bbm.localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.submit_to_local_account(
            request, self.response, self.site_settings)

        mock_submit_tracking.assert_called_once_with(
            'bbm_tracking_code',
            request, self.response, {"cd3": 'Visitor', 'cd1': "0000-000-01"})

    @patch(submit_tracking_method)
    def test_submit_to_bbm_analytics_if_cookie_set(self, mock_submit_tracking):
        '''
        Given that bbm_ga_account_subdomain and bbm_ga_tracking_code
        are set in Gem Settings, and the BBM cookie is set, info
        should be sent to the additional GA account.
        '''

        request = RequestFactory().get(
            '/',
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.COOKIES['bbm'] = 'true'
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.submit_to_local_account(
            request, self.response, self.site_settings)

        mock_submit_tracking.assert_called_once_with(
            'bbm_tracking_code',
            request, self.response, {"cd3": 'Visitor', 'cd1': "0000-000-01"})

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_account(self, mock_submit_tracking):
        '''
        Given that bbm_ga_account_subdomain and bbm_ga_tracking_code
        are set in Gem Settings, and the URL does not contain the
        bbm_ga_account_subdomain, info should be sent to
        the local GA account, not the additional GA account.
        '''

        request = RequestFactory().get(
            '/',
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01",)
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.submit_to_local_account(
            request, self.response, self.site_settings)

        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request,
            self.response,
            {"cd3": 'Visitor', 'cd1': "0000-000-01"}
        )

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_account__custom_params(self,
                                                       mock_submit_tracking):
        '''
        Given that bbm_ga_account_subdomain and bbm_ga_tracking_code
        are set in Gem Settings, and the URL does not contain the
        bbm_ga_account_subdomain, info should be sent to
        the local GA account, not the additional GA account.
        '''
        # create a user with a profile
        self.user = User.objects.create_user(
            username='******',
            email='*****@*****.**',
            password='******')
        self.client.login(username='******', password='******')
        self.user.profile.gender = 'f'

        self.user.profile.save()

        request = RequestFactory().get(
            '/',
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01",
        )
        request.site = self.main.get_site()
        request.user = self.user
        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.submit_to_local_account(
            request, self.response, self.site_settings)
        cd1 = middleware.get_visitor_id(request)
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request,
            self.response,
            {"cd3": 'Registered', 'cd2': self.user.profile.uuid, 'cd1': cd1})

    @patch(submit_tracking_method)
    def test_submit_to_local_ga__ignored_info(self, mock_submit_tracking):
        '''
        Paths in GOOGLE_ANALYTICS_IGNORE_PATH should not invoke
        a call to google analytics tracking
        '''

        request = RequestFactory().get(
            '/profiles/password-reset/',
            HTTP_HOST='localhost',
        )
        request.site = self.main.get_site()
        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # test that the tracking method is not called with senstive info
        mock_submit_tracking.assert_not_called()

        request = RequestFactory().get(
            '/profiles/reset-success/',
            HTTP_HOST='localhost',
        )
        middleware.process_response(
            request, self.response)
        mock_submit_tracking.assert_not_called()

        request = RequestFactory().get(
            '/profiles/reset-password/',
            HTTP_HOST='localhost',
        )
        middleware.process_response(
            request, self.response)
        mock_submit_tracking.assert_not_called()

    @patch(submit_tracking_method)
    def test_submit_to_local_ga__sensitive_info(self, mock_submit_tracking):
        '''
        Paths with sensitive information should not
        be tracked on google analytics
        '''

        request = RequestFactory().get(
            '/search/?q=user%40user.com',
            HTTP_HOST='localhost',
        )
        request.site = self.main.get_site()
        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        mock_submit_tracking.assert_not_called()

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_valid_info(self, mock_submit_tracking):

        request = RequestFactory().get(
            '/search/?q=whatislife',
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # a normal response should activate GA tracking
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {"cd3": 'Visitor', 'cd1': "0000-000-01"})

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_articlepage_title(
            self, mock_submit_tracking):
        """requests for article with tags should
        make a submit tracking with a cd6 value in the
        custom params containing all the article tags"""

        request = RequestFactory().get(
            '/sections-main1-1/{}/{}/'.format(
                self.yourmind.slug,
                self.article2.slug),
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # a normal response should activate GA tracking
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {'cd5': self.article2.title,
                "cd3": 'Visitor',
                'cd1': "0000-000-01",
             })

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_translated_articlepage_title(
            self, mock_submit_tracking):
        """requests for article with tags should
        make a submit tracking with a cd6 value in the
        custom params containing all the article tags"""

        french = SiteLanguageRelation.objects.create(
            language_setting=Languages.for_site(Site.objects.first()),
            locale='fr',
            is_active=True)
        french_article = self.mk_article_translation(self.article2, french)
        french_article.title = "french translation of article"
        french_article.save_revision().publish()
        request = RequestFactory().get(
            '/sections-main1-1/{}/{}/'.format(
                self.yourmind.slug,
                french_article.slug),
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.COOKIES[settings.LANGUAGE_COOKIE_NAME] = french.locale
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # check that the tilte of the article in the main languge is used
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {'cd5': self.article2.title,
                "cd3": 'Visitor',
                'cd1': "0000-000-01",
             })

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_articlepage_with_tags(
            self, mock_submit_tracking):
        """requests for article with tags should
        make a submit tracking with a cd6 value in the
        custom params containing all the article tags"""

        request = RequestFactory().get(
            '/sections-main1-1/{}/{}/'.format(
                self.yourmind.slug,
                self.article.slug),
            HTTP_HOST='localhost',
            HTTP_X_DCMGUID="0000-000-01"
        )
        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # a normal response should activate GA tracking
        nav_tags = ArticlePageTags.objects.all()
        tags = [nav_tag.tag.title for nav_tag in nav_tags]
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {'cd5': self.article.title,
                "cd3": 'Visitor', 'cd1': "0000-000-01",
                'cd6': "|".join(tags)}
        )

    @patch(submit_tracking_method)
    def test_submit_to_local_ga_articlepage_no_tags(
            self, mock_submit_tracking):
        '''request for articles with not tags
        should not have a cd6 value in
        the custom params'''

        request = RequestFactory().get(
            '/sections-main1-1/{}/{}/'.format(
                self.yourmind.slug,
                self.article2.slug),
            HTTP_X_DCMGUID="0000-000-01"
        )

        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # a normal response should activate GA tracking
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {'cd5': self.article2.title,
                "cd3": 'Visitor',
                'cd1': "0000-000-01"})

    @patch(submit_tracking_method)
    def test_submit_to_local_ga__footerpage__no_tags(
            self, mock_submit_tracking):
        '''request for articles with not tags
        should not have a cd6 value in
        the custom params'''

        request = RequestFactory().get(
            '/footers-main1-1/{}/'.format(
                self.footer.slug),
            HTTP_X_DCMGUID="0000-000-01"
        )

        request.site = self.main.get_site()

        middleware = GemMoloGoogleAnalyticsMiddleware()
        middleware.process_response(
            request, self.response)
        # a normal response should activate GA tracking
        mock_submit_tracking.assert_called_once_with(
            'local_ga_tracking_code',
            request, self.response,
            {'cd5': self.footer.title,
                "cd3": 'Visitor', 'cd1': "0000-000-01"})