-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from zope.interface import provider | ||
from zope.schema.interfaces import IVocabularyFactory | ||
from zope.schema.vocabulary import SimpleTerm | ||
from zope.schema.vocabulary import SimpleVocabulary | ||
|
||
|
||
OPCOES = [ | ||
("servidor", "Servidor"), | ||
("terceiro", "Tercerizado"), | ||
] | ||
|
||
|
||
@provider(IVocabularyFactory) | ||
def vocab_cargos(context) -> SimpleVocabulary: | ||
"""Cargos da estrutura do TRE-PR.""" | ||
terms = [] | ||
for token, title in OPCOES: | ||
terms.append(SimpleTerm(token, token, title)) | ||
return SimpleVocabulary(terms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from trepr.intranet import PACKAGE_NAME | ||
from zope.schema.vocabulary import SimpleVocabulary | ||
|
||
import pytest | ||
|
||
|
||
class TestVocabCargos: | ||
name = f"{PACKAGE_NAME}.vocabulary.cargos" | ||
|
||
@pytest.fixture(autouse=True) | ||
def _vocab(self, get_vocabulary, portal): | ||
self.vocab = get_vocabulary(self.name, portal) | ||
|
||
def test_vocabulary(self): | ||
assert self.vocab is not None | ||
assert isinstance(self.vocab, SimpleVocabulary) | ||
|
||
@pytest.mark.parametrize( | ||
"token,title", | ||
[ | ||
["servidor", "Servidor"], | ||
["terceiro", "Terceirizado"], | ||
], | ||
) | ||
def test_term(self, token, title): | ||
term = self.vocab.getTermByToken(token) | ||
assert term is not None | ||
assert term.title == title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters