Skip to content

Commit f4bfe19

Browse files
test: add test for to_json() method
This should get us to 100% test coverage on `gitlab/base.py`
1 parent 14d2a82 commit f4bfe19

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/unit/base/test_rest_object.py

+6
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ def test_attributes_has_parent_attrs(fake_object_with_parent):
290290
assert result == {"attr1": "foo", "alist": [1, 2, 3], "test_id": "42"}
291291

292292

293+
def test_to_json(fake_object):
294+
assert fake_object.attr1 == "foo"
295+
result = fake_object.to_json()
296+
assert result == '{"attr1": "foo", "alist": [1, 2, 3]}'
297+
298+
293299
def test_asdict(fake_object):
294300
assert fake_object.attr1 == "foo"
295301
result = fake_object.asdict()

0 commit comments

Comments
 (0)