Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Term CRUD tests #1480

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ class TermFactory(BaseFactory):
"""Term Factory."""

text = FuzzyText()
discoverable = Faker().pybool()
project = SubFactory(ProjectFactory)

class Meta:
Expand Down
49 changes: 49 additions & 0 deletions tests/term/test_term_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pytest


def test_get(session, term):
from dispatch.term.service import get

t_term = get(db_session=session, term_id=term.id)
assert t_term.id == term.id


def test_create(session, project):
from dispatch.term.service import create
from dispatch.term.models import TermCreate

text = "text"
discoverable = True

term_in = TermCreate(
text=text,
discoverable=discoverable,
project=project,
)
term = create(db_session=session, term_in=term_in)
assert term


@pytest.mark.skip
def test_update(session, term):
from dispatch.term.service import update
from dispatch.term.models import TermUpdate

text = "updated text"

term_in = TermUpdate(
text=text,
)
term = update(
db_session=session,
term=term,
term_in=term_in,
)
assert term.text == text


def test_delete(session, term):
from dispatch.term.service import delete, get

delete(db_session=session, term_id=term.id)
assert not get(db_session=session, term_id=term.id)