Breaking long strings into multiple lines

This commit is contained in:
Taha Rushain 2020-07-19 01:49:38 +05:00
parent 3292b664ec
commit 1cdfb0ed0d
2 changed files with 9 additions and 4 deletions

View file

@ -52,7 +52,9 @@ class GoogleAnalyticsGTagNode(Node):
def __init__(self):
self.property_id = get_required_setting(
'GOOGLE_ANALYTICS_GTAG_PROPERTY_ID', PROPERTY_ID_RE,
"must be a string looking like one of these patterns ('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX', 'G-XXXXXXXX', 'DC-XXXXXXXX')")
'''must be a string looking like one of these patterns
('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX',
'G-XXXXXXXX', 'DC-XXXXXXXX')''')
def render(self, context):
other_fields = {}

View file

@ -61,7 +61,8 @@ class GoogleAnalyticsTagTestCase(TagTestCase):
def test_tag_with_measurement_id(self):
r = self.render_tag('google_analytics_gtag', 'google_analytics_gtag')
self.assertTrue(
'<script async src="https://www.googletagmanager.com/gtag/js?id=G-12345678"></script>'
('<script async src="https://www.googletagmanager.com/gtag/'+
'js?id=G-12345678"></script>')
in r, r)
self.assertTrue("gtag('js', new Date());" in r, r)
self.assertTrue("gtag('config', 'G-12345678');" in r, r)
@ -70,7 +71,8 @@ class GoogleAnalyticsTagTestCase(TagTestCase):
def test_tag_with_conversion_id(self):
r = self.render_tag('google_analytics_gtag', 'google_analytics_gtag')
self.assertTrue(
'<script async src="https://www.googletagmanager.com/gtag/js?id=AW-1234567890"></script>'
('<script async src="https://www.googletagmanager.com/gtag/'+
'js?id=AW-1234567890"></script>')
in r, r)
self.assertTrue("gtag('js', new Date());" in r, r)
self.assertTrue("gtag('config', 'AW-1234567890');" in r, r)
@ -79,7 +81,8 @@ class GoogleAnalyticsTagTestCase(TagTestCase):
def test_tag_with_advertiser_id(self):
r = self.render_tag('google_analytics_gtag', 'google_analytics_gtag')
self.assertTrue(
'<script async src="https://www.googletagmanager.com/gtag/js?id=DC-12345678"></script>'
('<script async src="https://www.googletagmanager.com/gtag/'+
'js?id=DC-12345678"></script>')
in r, r)
self.assertTrue("gtag('js', new Date());" in r, r)
self.assertTrue("gtag('config', 'DC-12345678');" in r, r)