|  | 
|  | 1 | +import unittest | 
|  | 2 | +import app | 
|  | 3 | + | 
|  | 4 | +class TestDockerapp(unittest.TestCase): | 
|  | 5 | + | 
|  | 6 | + def setUp(self): | 
|  | 7 | + self.app = app.app.test_client() | 
|  | 8 | + | 
|  | 9 | + def test_save_value(self): | 
|  | 10 | + response = self.app.post('/', data=dict(submit='save', key='2', cache_value='two')) | 
|  | 11 | + assert response.status_code == 200 | 
|  | 12 | + assert b'2' in response.data | 
|  | 13 | + assert b'two' in response.data | 
|  | 14 | + | 
|  | 15 | + def test_load_value(self): | 
|  | 16 | + self.app.post('/', data=dict(submit='save', key='2', cache_value='two')) | 
|  | 17 | + response = self.app.post('/', data=dict(submit='load', key='2')) | 
|  | 18 | + assert response.status_code == 200 | 
|  | 19 | + assert b'2' in response.data | 
|  | 20 | + assert b'two' in response.data | 
|  | 21 | + | 
|  | 22 | +if __name__=='__main__': | 
|  | 23 | + unittest.main() | 
0 commit comments