Esempio n. 1
0
    def setUp(self):
        self.testapp = TestApp(app)
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()

        self.loader = FixtureLoader()
        self.loader.load_data()
Esempio n. 2
0
class TestAPI(object):

    def setUp(self):
        self.testapp = TestApp(app)
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()

        self.loader = FixtureLoader()
        self.loader.load_data()

    def test_get_greetings(self):
        response = self.testapp.get('/api/greetings.json?guestbook=test')

        eq_(response.status, '200 OK')
        eq_(response.headers.get('Content-Type'), 'application/json')

        response_data = json.loads(response.body)
        eq_(len(response_data), 2, 'Greeting API should return 2 objects')