diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-07-03 23:43:53 +0200 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-07-03 18:33:38 -0700 |
commit | 97e0eb9267202052ed14882258dceca0f6c4afd7 (patch) | |
tree | cbd00f826a80c9216193be611a5c61faee6fe2ce /tests/functional/api/test_snippets.py | |
parent | 04c6063183d94fe8970bdad485cf8221db9c31a8 (diff) | |
download | gitlab-97e0eb9267202052ed14882258dceca0f6c4afd7.tar.gz |
test(functional): replace len() calls with list membership checks
Diffstat (limited to 'tests/functional/api/test_snippets.py')
-rw-r--r-- | tests/functional/api/test_snippets.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/functional/api/test_snippets.py b/tests/functional/api/test_snippets.py index ce235f3..f9084e1 100644 --- a/tests/functional/api/test_snippets.py +++ b/tests/functional/api/test_snippets.py @@ -3,7 +3,7 @@ import gitlab def test_snippets(gl): snippets = gl.snippets.list(all=True) - assert len(snippets) == 0 + assert not snippets snippet = gl.snippets.create( {"title": "snippet1", "file_name": "snippet1.py", "content": "import gitlab"} @@ -20,8 +20,7 @@ def test_snippets(gl): assert snippet.user_agent_detail()["user_agent"] snippet.delete() - snippets = gl.snippets.list(all=True) - assert len(snippets) == 0 + assert snippet not in gl.snippets.list(all=True) def test_project_snippets(project): @@ -42,10 +41,9 @@ def test_project_snippets(project): def test_project_snippet_discussion(project): snippet = project.snippets.list()[0] - size = len(snippet.discussions.list()) discussion = snippet.discussions.create({"body": "Discussion body"}) - assert len(snippet.discussions.list()) == size + 1 + assert discussion in snippet.discussions.list() note = discussion.notes.create({"body": "first note"}) note_from_get = discussion.notes.get(note.id) @@ -68,7 +66,7 @@ def test_project_snippet_file(project): snippet = project.snippets.get(snippet.id) assert snippet.content().decode() == "initial content" assert snippet.file_name == "bar.py" + assert snippet in project.snippets.list() - size = len(project.snippets.list()) snippet.delete() - assert len(project.snippets.list()) == (size - 1) + assert snippet not in project.snippets.list() |