Commit e6541e22662e4997f50adad492389fd61b87e269
1 parent
c1576b4d
Exists in
master
alteração dos testes para funcionarem melhor (separação da função DELETE)
Showing
3 changed files
with
74 additions
and
48 deletions
Show diff stats
wscacicneo/test/results.txt
wscacicneo/test/test_user_attributes.py
... | ... | @@ -7,7 +7,7 @@ import json |
7 | 7 | from wscacicneo.model.user import User |
8 | 8 | from wscacicneo.model.user import UserBase |
9 | 9 | |
10 | -class TestUserBase(unittest.TestCase): | |
10 | +class TestUserAttributes(unittest.TestCase): | |
11 | 11 | """ |
12 | 12 | Testa base do órgão no LB |
13 | 13 | """ |
... | ... | @@ -22,14 +22,15 @@ class TestUserBase(unittest.TestCase): |
22 | 22 | Insere atributos na base users |
23 | 23 | """ |
24 | 24 | user_obj = User( |
25 | - nome='Fernando Goku', | |
26 | - matricula='12311231', | |
27 | - email='admin@planemaneto.gov.br', | |
28 | - telefone='(61) 2025-4117', | |
29 | - orgao='Ministério do Pppp', | |
30 | - cargo='Gestor de TI', | |
31 | - setor='Setor de TI', | |
32 | - permissao='administrador' | |
25 | + nome='test1', | |
26 | + matricula='test1', | |
27 | + email='test1@gov.br', | |
28 | + telefone='test1', | |
29 | + orgao='test1', | |
30 | + cargo='test1', | |
31 | + setor='test1', | |
32 | + permissao='Administrador', | |
33 | + senha='123' | |
33 | 34 | ) |
34 | 35 | results = user_obj.create_user() |
35 | 36 | var_file = open("results.txt", "w") |
... | ... | @@ -38,26 +39,6 @@ class TestUserBase(unittest.TestCase): |
38 | 39 | |
39 | 40 | self.assertIsInstance(results, int) |
40 | 41 | |
41 | - def test_delete_attributes(self): | |
42 | - """ | |
43 | - Deleta doc apartir do id | |
44 | - """ | |
45 | - user_obj = User( | |
46 | - nome='Fernando Goku', | |
47 | - matricula='12311231', | |
48 | - email='admin@planemaneto.gov.br', | |
49 | - telefone='(61) 2025-4117', | |
50 | - orgao='Ministério do Pppp', | |
51 | - cargo='Gestor de TI', | |
52 | - setor='Setor de TI', | |
53 | - permissao='administrador' | |
54 | - ) | |
55 | - matricula_user='12311231' | |
56 | - search = user_obj.search_user(matricula_user) | |
57 | - id = search.results[0]._metadata.id_doc | |
58 | - delete = user_obj.delete_user(id) | |
59 | - | |
60 | - assert(delete == 'DELETED') | |
61 | 42 | |
62 | 43 | def test_get_attributes(self): |
63 | 44 | """ |
... | ... | @@ -70,29 +51,30 @@ class TestUserBase(unittest.TestCase): |
70 | 51 | Test Edita Usuário |
71 | 52 | """ |
72 | 53 | user_obj = User( |
73 | - nome='Fernando Goku', | |
74 | - matricula='12311231', | |
75 | - email='admin@planemaneto.gov.br', | |
76 | - telefone='(61) 2025-4117', | |
77 | - orgao='Ministério do Pppp', | |
78 | - cargo='Gestor de TI', | |
79 | - setor='Setor de TI', | |
80 | - permissao='administrador' | |
54 | + nome='test1', | |
55 | + matricula='test1', | |
56 | + email='test1@gov.br', | |
57 | + telefone='test1', | |
58 | + orgao='test1', | |
59 | + cargo='test1', | |
60 | + setor='test1', | |
61 | + permissao='Administrador', | |
62 | + senha='123' | |
81 | 63 | ) |
82 | 64 | user = { |
83 | - 'nome' :'Goku', | |
84 | - 'matricula':'12311231', | |
85 | - 'email':'admin@planemaneto.gov.br', | |
86 | - 'telefone':'(61) 2025-4117', | |
87 | - 'orgao':'Ministério do Pppp', | |
88 | - 'cargo':'Gestor de TI', | |
89 | - 'setor':'Setor de TI', | |
90 | - 'permissao':'administrador' | |
65 | + 'nome' :'test1', | |
66 | + 'matricula':'test1', | |
67 | + 'email':'test1@gov.br', | |
68 | + 'telefone':'test1', | |
69 | + 'orgao':'test1', | |
70 | + 'cargo':'test1', | |
71 | + 'setor':'test1', | |
72 | + 'permissao':'Administrador', | |
73 | + 'senha':'123' | |
91 | 74 | } |
92 | - matricula_user='12311231' | |
75 | + matricula_user='test1' | |
93 | 76 | search = user_obj.search_user(matricula_user) |
94 | 77 | id = search.results[0]._metadata.id_doc |
95 | - print("KKKKKKKKKKKKKKKKKKKKK",id) | |
96 | 78 | doc = json.dumps(user) |
97 | 79 | edit = user_obj.edit_user(id, doc) |
98 | 80 | ... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | + #!/usr/env python | |
2 | +# -*- coding: utf-8 -*- | |
3 | +__author__ = 'adley' | |
4 | + | |
5 | +import unittest | |
6 | +import json | |
7 | +from wscacicneo.model.user import User | |
8 | +from wscacicneo.model.user import UserBase | |
9 | + | |
10 | +class TestUserDelete(unittest.TestCase): | |
11 | + def setUp(self): | |
12 | + """ | |
13 | + Carregando atributos genéricos do teste | |
14 | + """ | |
15 | + self.documentrest = UserBase().documentrest | |
16 | + | |
17 | + | |
18 | + def test_delete_attributes(self): | |
19 | + """ | |
20 | + Deleta doc apartir do id | |
21 | + """ | |
22 | + user_obj = User( | |
23 | + nome='test1', | |
24 | + matricula='test1', | |
25 | + email='test1@gov.br', | |
26 | + telefone='test1', | |
27 | + orgao='test1', | |
28 | + cargo='test1', | |
29 | + setor='test1', | |
30 | + permissao='Administrador', | |
31 | + senha='123' | |
32 | + ) | |
33 | + matricula_user='test1' | |
34 | + search = user_obj.search_user(matricula_user) | |
35 | + id = search.results[0]._metadata.id_doc | |
36 | + delete = user_obj.delete_user(id) | |
37 | + | |
38 | + assert(delete == 'DELETED') | |
39 | + | |
40 | + def tearDown(self): | |
41 | + """ | |
42 | + Apaga dados do teste | |
43 | + """ | |
44 | + pass | ... | ... |