38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""The bamboohr words, mapped to the app's vocabulary."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import importlib
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from app import models # noqa: E402
|
|
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
|
|
|
|
hosts = importlib.import_module("app.prep.hosts.bamboohr")
|
|
|
|
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
|
|
|
|
|
|
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
|
|
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
|
|
words = getattr(hosts, table)
|
|
assert all(key == key.strip().lower() for key in words)
|
|
assert set(words.values()) <= {*VOCABULARY[table], ""}
|
|
|
|
|
|
@pytest.mark.parametrize(("word", "value"), [('0', 'onsite'), ('1', 'remote'), ('2', 'hybrid')])
|
|
def test_remote_words(word: str, value: str) -> None:
|
|
assert hosts.REMOTE[word] == value
|
|
|
|
|
|
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('part time', 'part_time'), ('intern', 'internship'), ('contractor', 'contract')])
|
|
def test_employment_words(word: str, value: str) -> None:
|
|
assert hosts.EMPLOYMENT[word] == value
|