def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False self.app = app.test_client() warnings.filterwarnings("ignore", category=ResourceWarning, message="unclosed.*<ssl.SSLSocket.*>")
def setUp(self): self.app = app.test_client() self.app.testing = True self.sampleResponse = { "title": "Young The Giant with Grouplove", "url": "https://seatgeek.com/young-the-giant-with-grouplove-tickets/new-york-new-york-terminal-5-2012-03-09/concert/721901/", "datetime_local": "2012-03-09T19:00:00", "performers": [{ "name": "Young The Giant", "short_name": "Young The Giant", "url": "https://seatgeek.com/young-the-giant-tickets/", "image": "https://chairnerd.global.ssl.fastly.net/images/bandshuge/band_8741.jpg", "primary": True, "id": 8741, "score": 6404, "type": "band", "slug": "young-the-giant" }], "venue": { "extended_address": "Baker Street", "country": "US", "state": "NY", "address": "ABC Store", "id": 814 }, "datetime_utc": "2012-03-10T00:00:00", "type": "concert", "id": 721901, "description": "Sample", "status_code": 200, }
def test_post(self): self.test_app = app.test_client() response = self.test_app.get('/', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_index(self): tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_index_404(self): tester = app.test_client(self) response = tester.get('/404/', content_type='html/text') self.assertTrue( b'OOPS!!!! PAGE NOT FOUND!! PLEASE RETURN TO HOMEPAGE BY CLICKING ON THE HEADER, OTHERWISE CLICK ONE OF THE TABS ABOVE =]' in response.data)
def test_index_Map(self): tester = app.test_client(self) response = tester.get('/Map/', content_type='html/text') self.assertTrue(b'Japan on Google Maps' in response.data)
def setUp(self): handler_app.testing = True self.client = handler_app.test_client()
def test_user(self, val): tester = app.test_client() response = tester.get("/user/test_user") self.assertEqual(response.status, '200 OK') self.assertEqual(response.json, get_user_result)
def test_index_Supra(self): tester = app.test_client(self) response = tester.get('/Supra/', content_type='html/text') self.assertTrue(b'Toyota Supra (year 93-02)' in response.data)
def test_index_DC5(self): tester = app.test_client(self) response = tester.get('/DC5', content_type='html/text') self.assertTrue(b'Honda Integra DC5 (year 01-06)' in response.data)
def test_index_homepage(self): tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.assertTrue(b'Welcome to JDM Cars' in response.data)
def setUp(self): self.app = app.test_client() self.db = db.get_db()
def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_METHODS'] = [] # This is the magic self.app = app.test_client()
def client(): return index_app.test_client()
def client(): app.config['TESTING'] = True client = app.test_client() yield client
def test_index_S15(self): tester = app.test_client(self) response = tester.get('/S15/', content_type='html/text') self.assertTrue(b'Nissan S15 (year 99-02)' in response.data)
def setUp(self): self.app = app.test_client()
def test_index_Chaser(self): tester = app.test_client(self) response = tester.get('/Chaser/', content_type='html/text') self.assertTrue(b'Toyota Chaser (year 96-01)' in response.data)
def test_NotExist(self, mock): tester = app.test_client() response = tester.get("/user/test_user123") self.assertEqual(response.status, '404 NOT FOUND')
def setUp(self): api = app.test_client() self.response = api.get('cidade/Penápolis/BR')