コード例 #1
0
 def test_encode_without_country(self):
     encoder = JSONSnippetEncoder()
     data = {'id': 99, 'text': 'test-text',
             'icon': 'test-icon', 'url': 'test-url',
             'weight': 100}
     snippet = JSONSnippetFactory.build(**data)
     result = encoder.default(snippet)
     eq_(result, data)
コード例 #2
0
 def test_encode_jsonsnippet(self):
     encoder = SnippetEncoder()
     data = {'id': 99, 'text': 'test-text',
             'icon': 'test-icon', 'url': 'test-url',
             'country': 'us', 'weight': 100}
     snippet = JSONSnippetFactory.build(**data)
     result = encoder.default(snippet)
     data['target_geo'] = data.pop('country').upper()
     eq_(result, data)
コード例 #3
0
 def test_encode_without_country(self):
     encoder = JSONSnippetEncoder()
     data = {
         'id': 99,
         'text': 'test-text',
         'icon': 'test-icon',
         'url': 'test-url',
         'weight': 100
     }
     snippet = JSONSnippetFactory.build(**data)
     result = encoder.default(snippet)
     eq_(result, data)
コード例 #4
0
 def test_encode_jsonsnippet(self):
     encoder = SnippetEncoder()
     data = {
         'id': 99,
         'text': 'test-text',
         'icon': 'test-icon',
         'url': 'test-url',
         'country': 'us',
         'weight': 100
     }
     snippet = JSONSnippetFactory.build(**data)
     result = encoder.default(snippet)
     data['target_geo'] = data.pop('country').upper()
     eq_(result, data)