Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1078 from python-gitlab/refactor/split-unit-tests
Refactor: split unit tests by API resources
- Loading branch information
Showing
42 changed files
with
2,778 additions
and
2,617 deletions.
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
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,58 @@ | ||
from gitlab.mixins import ( | ||
CreateMixin, | ||
CRUDMixin, | ||
DeleteMixin, | ||
GetMixin, | ||
ListMixin, | ||
NoUpdateMixin, | ||
UpdateMixin, | ||
RetrieveMixin, | ||
) | ||
|
||
|
||
def test_retrieve_mixin(): | ||
class M(RetrieveMixin): | ||
pass | ||
|
||
obj = M() | ||
assert hasattr(obj, "list") | ||
assert hasattr(obj, "get") | ||
assert not hasattr(obj, "create") | ||
assert not hasattr(obj, "update") | ||
assert not hasattr(obj, "delete") | ||
assert isinstance(obj, ListMixin) | ||
assert isinstance(obj, GetMixin) | ||
|
||
|
||
def test_crud_mixin(): | ||
class M(CRUDMixin): | ||
pass | ||
|
||
obj = M() | ||
assert hasattr(obj, "get") | ||
assert hasattr(obj, "list") | ||
assert hasattr(obj, "create") | ||
assert hasattr(obj, "update") | ||
assert hasattr(obj, "delete") | ||
assert isinstance(obj, ListMixin) | ||
assert isinstance(obj, GetMixin) | ||
assert isinstance(obj, CreateMixin) | ||
assert isinstance(obj, UpdateMixin) | ||
assert isinstance(obj, DeleteMixin) | ||
|
||
|
||
def test_no_update_mixin(): | ||
class M(NoUpdateMixin): | ||
pass | ||
|
||
obj = M() | ||
assert hasattr(obj, "get") | ||
assert hasattr(obj, "list") | ||
assert hasattr(obj, "create") | ||
assert not hasattr(obj, "update") | ||
assert hasattr(obj, "delete") | ||
assert isinstance(obj, ListMixin) | ||
assert isinstance(obj, GetMixin) | ||
assert isinstance(obj, CreateMixin) | ||
assert not isinstance(obj, UpdateMixin) | ||
assert isinstance(obj, DeleteMixin) |
Oops, something went wrong.