Skip to content

Instantly share code, notes, and snippets.

@cristianoliveira
Created August 12, 2016 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristianoliveira/bd1d533fa7e5a31fd002d6b7223202fa to your computer and use it in GitHub Desktop.
Save cristianoliveira/bd1d533fa7e5a31fd002d6b7223202fa to your computer and use it in GitHub Desktop.
testes
class TestFeedCollectionHandler(FeedServerTestCase):
headers = {'Content-Type': 'application/json'}
def setUp(self):
super(TestFeedCollectionHandler, self).setUp()
self.data = {'uri': 'glb.com/minhaeditoria/',
'product': 'glb-feed',
'name': 'globo feed',
'images': {},
'semanticAnnotation': [
{ u'dummy': 'dummy '}
]}
@gen_test
def test_feed_does_not_exists_for_a_given_product(self):
response = yield self.http_client.fetch(self.get_url('/feeds/product1/'), raise_error=False, method='GET')
self.assertEquals(response.code, 200)
feeds_data = json.loads(response.body)
feeds = feeds_data.get('items')
self.assertEquals(0, len(feeds))
@gen_test
def test_should_only_return_feeds_from_a_given_product(self):
yield FeedFactory.create(product='product1')
yield FeedFactory.create(product='product2')
response = yield self.http_client.fetch(self.get_url('/feeds/product1/'), raise_error=False, method='GET')
self.assertEquals(response.code, 200)
feeds_data = json.loads(response.body)
feeds = feeds_data.get('items')
self.assertEquals(1, len(feeds))
self.assertEquals('product1', feeds[0]['product'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment