Skip to content

Commit

Permalink
TEMP: Start using requests_mock
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Feb 4, 2022
1 parent e9e13a0 commit 5f0d0f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pre-commit~=2.17
pylint~=2.12
pytest~=6.2
pytest-cov~=3.0
requests-mock~=1.9
14 changes: 12 additions & 2 deletions tests/test_dataresource.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
"""Test parse strategies."""
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from requests_mock import Mocker

def test_dataresource():

def test_dataresource(requests_mock: "Mocker") -> None:
"""Test dataresource parse strategy."""
import json

from otelib import OntoTransServer
from otelib.ontotransserver import OntoTransServer
from otelib.settings import Settings


data = {
"firstName": "Joe",
Expand All @@ -15,7 +21,11 @@ def test_dataresource():
"address": {"streetAddress": "101", "city": "San Diego", "state": "CA"},
"phoneNumbers": [{"type": "home", "number": "7349282382"}],
}

server = OntoTransServer("http://localhost:80")

requests_mock.post(f"{server.url}{Settings().prefix}/dataresource/", text="")

dataresource = server.create_dataresource(
downloadUrl="https://filesamples.com/samples/code/json/sample2.json",
mediaType="text/json",
Expand Down

0 comments on commit 5f0d0f0

Please sign in to comment.