forked from 4linux/DevOpsLab-HelloWorld
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
29 lines (21 loc) · 924 Bytes
/
test.py
File metadata and controls
29 lines (21 loc) · 924 Bytes
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
from app import app
import unittest
class Test(unittest.TestCase):
def setUp(self):
# cria uma instância do unittest, precisa do nome "setUp"
self.app = app.test_client()
def test_requisicao(self):
# envia uma requisicao GET para a URL
result = self.app.get('/')
# compara o status da requisicao (precisa ser igual a 200)
self.assertEqual(result.status_code, 200)
def test_conteudo(self):
# envia uma requisicao GET para a URL
result = self.app.get('/')
# verifica o retorno do conteudo da pagina
self.assertRegex(result.data.decode(), "Pipeline de Produção")
if __name__ == "__main__":
print('INICIANDO OS TESTES')
print('----------------------------------------------------------------------')
print('------------ AGUARDE A FINALIZAÇÃO DO PROCESSO DE BUILD --------------')
unittest.main(verbosity=2)