Created
August 12, 2016 13:33
-
-
Save cristianoliveira/bd1d533fa7e5a31fd002d6b7223202fa to your computer and use it in GitHub Desktop.
testes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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