Skip to content

Commit

Permalink
Merge pull request #208 from Mirantis/tests
Browse files Browse the repository at this point in the history
add more tests
  • Loading branch information
tomkukral authored Jan 31, 2018
2 parents e781bdc + bc548a0 commit c8a96e6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions kqueen/tests/test_serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from kqueen.serializers import KqueenJSONEncoder

import pytest


class SerByMethod:
def serialize(self):
return "ser"


class NotSerializable:
pass


@pytest.mark.parametrize('obj', [
SerByMethod()
])
def test_serializer(obj):
enc = KqueenJSONEncoder()

assert enc.default(obj) == 'ser'


def test_not_serializable(capsys):
obj = NotSerializable()
enc = KqueenJSONEncoder()

enc.default(obj)

out, err = capsys.readouterr()
assert "Unserialized" in out
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude =
omit =
./*.venv*/*
devenv.py
test_gke.py
run_*_test.py

[isort]
force_alphabetical_sort = True
Expand Down

0 comments on commit c8a96e6

Please sign in to comment.