Commit a11ae9fa643a8d52ccbd1fe87b092e39f42f0457
1 parent
fdc5dcfb
Exists in
master
tests delete e insert docs na base orgaos
Showing
1 changed file
with
57 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,57 @@ | @@ -0,0 +1,57 @@ | ||
1 | +#!/usr/env python | ||
2 | +# -*- coding: utf-8 -*- | ||
3 | +__author__ = 'eduardo' | ||
4 | + | ||
5 | +import unittest | ||
6 | +from wscacicneo.model.orgao import Orgao | ||
7 | +from wscacicneo.model.orgao import OrgaoBase | ||
8 | +from liblightbase.lbbase.struct import Base | ||
9 | +from liblightbase.lbutils import conv | ||
10 | + | ||
11 | +class TestOrgaoBase(unittest.TestCase): | ||
12 | + """ | ||
13 | + Testa base do órgão no LB | ||
14 | + """ | ||
15 | + def setUp(self): | ||
16 | + """ | ||
17 | + Carregando atributos genéricos do teste | ||
18 | + """ | ||
19 | + self.documentrest = OrgaoBase().documentrest | ||
20 | + | ||
21 | + def test_orgao_attributes(self): | ||
22 | + """ | ||
23 | + Insere atributos na base órgãos | ||
24 | + """ | ||
25 | + orgao_obj = Orgao( | ||
26 | + nome='Ministério do Planejameiaaaaaaaaanto', | ||
27 | + cargo='cargo', | ||
28 | + coleta='4h', | ||
29 | + sigla='MPOG', | ||
30 | + endereco='Esplanada bloco C', | ||
31 | + email='admin@planemaneto.gov.br', | ||
32 | + telefone='(61) 2025-4117' | ||
33 | + ) | ||
34 | + results = orgao_obj.create_orgao() | ||
35 | + var_file = open("results.txt", "w") | ||
36 | + cont = var_file.write(str(results)) | ||
37 | + var_file.close() | ||
38 | + | ||
39 | + assert(type(results) == int) | ||
40 | + | ||
41 | + def test_delete_attributes(self): | ||
42 | + """ | ||
43 | + Deleta doc apartir do id | ||
44 | + """ | ||
45 | + nm_orgao = 'Ministério do Planejameiaaaaaaaaanto', | ||
46 | + search = Orgao().search_orgao(nm_orgao) | ||
47 | + id = search['_metadata']['id_doc'] | ||
48 | + delete = Orgao().delete_orgao(id) | ||
49 | + | ||
50 | + assert(delete == 'DELETED') | ||
51 | + | ||
52 | + | ||
53 | + def tearDown(self): | ||
54 | + """ | ||
55 | + Apaga dados do teste | ||
56 | + """ | ||
57 | + pass |