Ejemplo n.º 1
0
class LeafItemTestCase(TestCase):
    def setUp(self):
        self.leaf = LeafItem(id=11977, likes=2, url='http://test.tv/50x50.txt')

    def test_str(self):
        self.assertEqual(str(self.leaf), 'http://test.tv/50x50.txt')

    @httprettified
    def test_content(self):
        with open(os.path.join(LOCALDIR, 'response/50x50.png')) as fp:
            body = fp.read()
        HTTPretty.register_uri(HTTPretty.GET,
                               'http://test.tv/50x50.txt',
                               body=body)
        self.assertEqual(self.leaf.content(), body)
        self.assertEqual(len(HTTPretty.latest_requests), 1)
        self.assertEqual(self.leaf.content(), body)  # Cached
        self.assertEqual(len(HTTPretty.latest_requests), 1)
Ejemplo n.º 2
0
class LeafItemTestCase(TestCase):
    def setUp(self):
        self.leaf = LeafItem(id=11977, likes=2, url='http://test.tv/50x50.txt')

    def test_str(self):
        self.assertEqual(str(self.leaf), 'http://test.tv/50x50.txt')

    @httprettified
    def test_content(self):
        with open(os.path.join(LOCALDIR, 'response/50x50.png')) as fp:
            body = fp.read()
        HTTPretty.register_uri(
            HTTPretty.GET,
            'http://test.tv/50x50.txt',
            body=body
        )
        self.assertEqual(self.leaf.content(), body)
        self.assertEqual(len(HTTPretty.latest_requests), 1)
        self.assertEqual(self.leaf.content(), body)  # Cached
        self.assertEqual(len(HTTPretty.latest_requests), 1)
Ejemplo n.º 3
0
 def setUp(self):
     self.leaf = LeafItem(id=11977, likes=2, url='http://test.tv/50x50.txt')
Ejemplo n.º 4
0
 def setUp(self):
     self.leaf = LeafItem(id=11977, likes=2, url='http://test.tv/50x50.txt')