Skip to content

Commit

Permalink
added test_batch.py for integration testing /batch endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrussimon committed Mar 13, 2017
1 parent 7511f29 commit 0fbbb3c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/integration_tests/python/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest


@pytest.fixture
@pytest.fixture(scope='module')
def with_hierarchy(api_as_admin, bunch, request, data_builder):
group = data_builder.create_group('test_prop_' + str(int(time.time() * 1000)))
project = data_builder.create_project(group)
Expand Down Expand Up @@ -44,7 +44,7 @@ def with_hierarchy_and_file_data(with_hierarchy):
return fixture_data


@pytest.fixture
@pytest.fixture(scope='module')
def with_gear(request, as_admin):
gear_name = 'test-gear'
r = as_admin.post('/gears/' + gear_name, json={
Expand Down
29 changes: 29 additions & 0 deletions test/integration_tests/python/test_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import json
import logging


log = logging.getLogger(__name__)
sh = logging.StreamHandler()
log.addHandler(sh)


def test_batch(with_gear, with_hierarchy, as_user, as_admin):
gear = with_gear
data = with_hierarchy

# get all
r = as_user.get('/batch')
assert r.ok

# get all w/o enforcing permissions
r = as_admin.get('/batch')
assert r.ok

# create a batch
r = as_admin.post('/batch', json={
'gear_id': gear,
'targets': [
{'type': 'acquisition', 'id': data.acquisition},
]
})
assert r.ok

0 comments on commit 0fbbb3c

Please sign in to comment.