Exemplo n.º 1
0
    def test_render(self):
        xml = render_xml(
            self.template, {
                'submission_id': 100,
                'security_code': 'AB12CD3',
                'rating_system': 'PEGI',
                'release_date': datetime.date(2013, 11, 1),
                'title': 'Twitter',
                'company': 'Test User',
                'rating': '16+',
                'descriptors':
                u'N\xc3\xa3o h\xc3\xa1 inadequa\xc3\xa7\xc3\xb5es',
                'interactive_elements': 'users interact'
            })
        assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
        assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
        assert '<FIELD NAME="storefront_company" VALUE="Test User"' in xml
        assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
        assert '<FIELD NAME="submission_id" VALUE="100"' in xml
        assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
        assert '<FIELD NAME="rating_system" VALUE="PEGI"' in xml
        assert '<FIELD NAME="release_date" VALUE="2013-11-01"' in xml
        assert '<FIELD NAME="storefront_title" VALUE="Twitter"' in xml
        assert '<FIELD NAME="storefront_rating" VALUE="16+"' in xml
        assert ('<FIELD NAME="storefront_descriptors" '
                u'VALUE="N\xc3\xa3o h\xc3\xa1 inadequa\xc3\xa7\xc3\xb5es"'
                in xml)
        assert ('<FIELD NAME="storefront_interactive_elements" '
                'VALUE="users interact"') in xml

        # The client base64 encodes these. Mimic what the client does here to
        # ensure no unicode problems.
        base64.b64encode(xml.encode('utf-8'))
Exemplo n.º 2
0
    def test_render(self):
        xml = render_xml(self.template, {
            'submission_id': 100,
            'security_code': 'AB12CD3',
            'rating_system': 'PEGI',
            'release_date': datetime.date(2013, 11, 1),
            'title': 'Twitter',
            'company': 'Test User',
            'rating': '16+',
            'descriptors': u'N\xc3\xa3o h\xc3\xa1 inadequa\xc3\xa7\xc3\xb5es',
            'interactive_elements': 'users interact'})
        assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
        assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
        assert '<FIELD NAME="storefront_company" VALUE="Test User"' in xml
        assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
        assert '<FIELD NAME="submission_id" VALUE="100"' in xml
        assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
        assert '<FIELD NAME="rating_system" VALUE="PEGI"' in xml
        assert '<FIELD NAME="release_date" VALUE="2013-11-01"' in xml
        assert '<FIELD NAME="storefront_title" VALUE="Twitter"' in xml
        assert '<FIELD NAME="storefront_rating" VALUE="16+"' in xml
        assert ('<FIELD NAME="storefront_descriptors" '
                u'VALUE="N\xc3\xa3o h\xc3\xa1 inadequa\xc3\xa7\xc3\xb5es"'
                in xml)
        assert ('<FIELD NAME="storefront_interactive_elements" '
                'VALUE="users interact"') in xml

        # The client base64 encodes these. Mimic what the client does here to
        # ensure no unicode problems.
        base64.b64encode(xml.encode('utf-8'))
Exemplo n.º 3
0
 def test_render(self):
     xml = render_xml(self.template, {
         'date_from': datetime.date(2011, 1, 1),
         'date_to': datetime.date(2011, 2, 1)})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="date_from" VALUE="2011-01-01"' in xml
     assert '<FIELD NAME="date_to" VALUE="2011-02-01"' in xml
Exemplo n.º 4
0
 def test_render(self):
     xml = render_xml(self.template, {
         'date_from': datetime.date(2011, 1, 1),
         'date_to': datetime.date(2011, 2, 1)})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="date_from" VALUE="2011-01-01"' in xml
     assert '<FIELD NAME="date_to" VALUE="2011-02-01"' in xml
Exemplo n.º 5
0
 def test_render(self):
     xml = render_xml(self.template, {'submission_id': 100,
                                      'security_code': 'AB12CD3'})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="submission_id" VALUE="100"' in xml
     assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
     assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
Exemplo n.º 6
0
 def test_render(self):
     xml = render_xml(self.template, {'submission_id': 100,
                                      'security_code': 'AB12CD3'})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="submission_id" VALUE="100"' in xml
     assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
     assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
     # If these aren't specified in the context they aren't included.
     assert not '<FIELD NAME="title"' in xml
Exemplo n.º 7
0
 def test_render(self):
     xml = render_xml(self.template, {'submission_id': 100,
                                      'security_code': 'AB12CD3'})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="submission_id" VALUE="100"' in xml
     assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
     assert '<FIELD NAME="company" VALUE="Mozilla"' in xml
     assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
     # If these aren't specified in the context they aren't included.
     assert not '<FIELD NAME="title"' in xml
Exemplo n.º 8
0
 def test_render(self):
     xml = render_xml(self.template, {
         'submission_id': 100,
         'security_code': 'AB12CD3',
         'rating_system': 'PEGI',
         'release_date': datetime.date(2013, 11, 1),
         'title': 'Twitter',
         'rating': '16+',
         'descriptors': 'violence, sex',
         'interactive_elements': 'users interact'})
     assert xml.startswith('<?xml version="1.0" encoding="utf-8"?>')
     assert '<FIELD NAME="password" VALUE="s3kr3t"' in xml
     assert '<FIELD NAME="storefront_company" VALUE="Mozilla"' in xml
     assert '<FIELD NAME="platform" VALUE="Firefox"' in xml
     assert '<FIELD NAME="submission_id" VALUE="100"' in xml
     assert '<FIELD NAME="security_code" VALUE="AB12CD3"' in xml
     assert '<FIELD NAME="rating_system" VALUE="PEGI"' in xml
     assert '<FIELD NAME="release_date" VALUE="2013-11-01"' in xml
     assert '<FIELD NAME="storefront_title" VALUE="Twitter"' in xml
     assert '<FIELD NAME="storefront_rating" VALUE="16+"' in xml
     assert ('<FIELD NAME="storefront_descriptors" '
             'VALUE="violence, sex"') in xml
     assert ('<FIELD NAME="storefront_interactive_elements" '
             'VALUE="users interact"') in xml