-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
33 lines (25 loc) · 1.08 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
from flask import Flask, url_for
from flask_testing import TestCase
class PremiumAirNotifierAppTests(TestCase):
def create_app(self):
from app import app
app.config['TESTING'] = True
return app
def test_index_page_looks_like_it_should(self):
response = self.client.get("/")
self.assert200(response)
self.assertTrue("All numbers" in response.data)
self.assertTrue("Add Number" in response.data)
self.assertTrue("First Name" in response.data)
self.assertTrue("Mobile Number" in response.data)
self.assertTrue("Send Gate Alerts" in response.data)
def test_when_number_added_its_displayed_on_the_page(self):
new_pax_data = {'number': '0079055045460'}
response = self.client.post('/save_number', data=new_pax_data)
self.assert_redirects(response, url_for('index'))
def test_when_sms_sent_an_sms_gets_sent(self):
response = self.client.get('/send_sms')
self.assert_redirects(response, url_for('index'))
if __name__ == '__main__':
unittest.main()