예제 #1
0
class TestApiWorker(unittest.TestCase):
    def setUp(self):
        self.aw = ApiWorker()

    def test_open(self):
        response = self.aw.open('release', '1')
        self.failUnless(response)
        self.failUnlessEqual(type(response), str)
        self.failUnless(
            re.search(r'<resp stat="ok"', response)
            )

        try:
            response = self.aw.open('release', '999999999999')
        except HTTPError, e:
            if e.code == 404:
                self.fail('Not found error should be catched')
            else:
                pass
예제 #2
0
 def setUp(self):
     self.aw = ApiWorker()