def setUp(self): self.app = server.app.test_client() server.initialize_logging(logging.CRITICAL) server.init_db() server.data_reset() server.data_load({ "name": "fido", "category": "dog", "available": True }) server.data_load({ "name": "kitty", "category": "cat", "available": True })
def setUpClass(cls): """ Run once before all tests """ server.app.debug = False server.initialize_logging(logging.INFO) # Set up the test database server.app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI
def setUpClass(cls): """ Run once before all tests """ server.app.debug = False server.initialize_logging(logging.ERROR)
# TRY: # nosetests --with-spec --spec-color --with-noy spec import logging import json import server from expects import * from noseOfYeti.tokeniser.support import noy_sup_setUp, noy_sup_tearDown describe "Test Pet Server": before_each: # Only log criticl errors server.app.debug = False server.initialize_logging(logging.ERROR) server.Pet.remove_all() server.Pet(0, 'fido', 'dog').save() server.Pet(0, 'kitty', 'cat').save() self.app = server.app.test_client() after_each: server.Pet.remove_all() it "should response to index page": resp = self.app.get('/') expect(resp.status_code).to(equal(200)) expect('Pet Demo REST API Service' in resp.data).to(be_true) it "should return a list of pets": resp = self.app.get('/pets')