Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: python
python:
- "3.7"
install:
- pipenv install --dev
script:
- pipenv run pytest
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ verify_ssl = true

[dev-packages]
pytest = "*"
requests-mock = "*"

[packages]
requests = "*"
structlog = "*"
attr = "*"

[requires]
python_version = "3.7"
18 changes: 17 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import attr
import pytest
import requests_mock

Expand All @@ -6,13 +7,25 @@

@pytest.fixture
def client():
pass
with requests_mock.Mocker() as m:
uri1 = 'mock://example.com/rest/login'
uri2 = 'mock://example.com/rest/status'
cookies = {'JSESSIONID': '11111111'}
json_object = {'fullname': 'User Name'}
m.post(uri1, cookies=cookies)
m.get(uri2, json=json_object)
client = models.Client('mock://example.com', 'test', 'test')
return client


# def test_get_record(client):
# """Test get_record function."""
# rec_obj = client.get_record(uuid, rec_type)
# assert False
def test_get_record(client):
"""Test get_record function."""
with requests_mock.Mocker() as m:
uri = '/rest/items/123?expand=all'
json_object = {'metadata': {'title': 'Sample title'}, 'type': 'item'}
m.get(uri, json=json_object)
rec_obj = client.get_record('123', 'items')
assert attr.asdict(rec_obj)['metadata'] == json_object['metadata']


# def test_filtered_item_search(client):
Expand Down