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)
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)
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)
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)