Skip to content

Commit 3344157

Browse files
committed
Add missing tests for project settings
1 parent 3d38150 commit 3344157

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

tests/client/test_projects.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import types
2-
from collections import defaultdict
2+
from collections import defaultdict, Iterator
33

44
import pytest
55
from six.moves import range
@@ -23,7 +23,7 @@
2323
# Projects class tests
2424

2525

26-
def test_client_projects_get_project(client):
26+
def test_projects_get(client):
2727
projects = client.projects
2828
# testing with int project id
2929
p1 = projects.get(int(TEST_PROJECT_ID))
@@ -34,7 +34,7 @@ def test_client_projects_get_project(client):
3434
assert p1.key == p2.key
3535

3636

37-
def test_client_projects_list_projects(client):
37+
def test_projects_list(client):
3838
projects = client.projects.list()
3939
assert client.projects.list() == []
4040

@@ -45,7 +45,7 @@ def test_client_projects_list_projects(client):
4545
assert int(TEST_PROJECT_ID) in projects
4646

4747

48-
def test_client_projects_summary(client, project):
48+
def test_projects_summary(client, project):
4949
# add at least one running or pending job to ensure summary is returned
5050
project.jobs.schedule(TEST_SPIDER_NAME, meta={'state': 'running'})
5151

@@ -60,7 +60,7 @@ def _get_summary():
6060

6161
# Project class tests
6262

63-
def test_project_subresources(project):
63+
def test_project_base(project):
6464
assert project.key == TEST_PROJECT_ID
6565
assert isinstance(project.collections, Collections)
6666
assert isinstance(project.jobs, Jobs)
@@ -254,3 +254,30 @@ def test_project_jobs_iter_last(project):
254254
lastsumm2 = list(project.jobs.iter_last())
255255
assert len(lastsumm2) == 1
256256
assert lastsumm2[0].get('key') == job2.key
257+
258+
259+
def test_settings_get_set(project):
260+
project.settings.set('job_runtime_limit', 20)
261+
assert project.settings.get('job_runtime_limit') == 20
262+
project.settings.set('job_runtime_limit', 24)
263+
assert project.settings.get('job_runtime_limit') == 24
264+
265+
266+
def test_settings_update(project):
267+
project.settings.set('job_runtime_limit', 20)
268+
project.settings.update({'job_runtime_limit': 24})
269+
assert project.settings.get('job_runtime_limit') == 24
270+
271+
272+
def test_settings_delete(project):
273+
project.settings.delete('job_runtime_limit')
274+
assert not project.settings.get('job_runtime_limit')
275+
276+
277+
def test_settings_iter_list(project):
278+
project.settings.set('job_runtime_limit', 24)
279+
settings_iter = project.settings.iter()
280+
assert isinstance(settings_iter, Iterator)
281+
settings_list = project.settings.list()
282+
assert ('job_runtime_limit', 24) in settings_list
283+
assert settings_list == list(settings_iter)

0 commit comments

Comments
 (0)