Skip to content

Commit

Permalink
removed holdings tests from monthly check
Browse files Browse the repository at this point in the history
  • Loading branch information
charlottekostelic committed Nov 5, 2024
1 parent 4321153 commit 3dc2268
Showing 1 changed file with 111 additions and 111 deletions.
222 changes: 111 additions & 111 deletions tests/test_monthly_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,117 +422,117 @@ def test_holdings_get_current(self, yaml_params, method_params):
]
)

def test_holdings_set_unset(self, yaml_params, method_params):
token = WorldcatAccessToken(
key=os.getenv("WCKEY"),
secret=os.getenv("WCSECRET"),
scopes=os.getenv("WCSCOPES"),
)

with MetadataSession(authorization=token) as session:
get_response = session.holdings_get_current("850940548")
holdings = get_response.json()["holdings"]
current_holding_endpoint_args = yaml_params(
get_response.request.url, get_response.request.method
)
current_holding_method_args = method_params(session.holdings_get_current)
assert current_holding_endpoint_args == current_holding_method_args

# make sure no holdings are set initially
if len(holdings) > 0:
session.holdings_unset(850940548)

# test setting holdings
set_response = session.holdings_set(850940548)
set_holding_endpoint_args = yaml_params(
set_response.request.url, set_response.request.method
)
set_holding_method_args = method_params(session.holdings_set)
assert set_holding_endpoint_args == set_holding_method_args
assert (
set_response.url.split("https://metadata.api.oclc.org/")[1].split("?")[
0
]
== "worldcat/manage/institution/holdings/850940548/set"
)
assert set_response.status_code == 200
assert set_response.json()["action"] == "Set Holdings"

# test deleting holdings
unset_response = session.holdings_unset(oclcNumber=850940548)
unset_holding_endpoint_args = yaml_params(
unset_response.request.url, unset_response.request.method
)
unset_holding_method_args = method_params(session.holdings_unset)
assert unset_holding_endpoint_args == unset_holding_method_args
assert unset_response.status_code == 200
assert (
unset_response.url.split("https://metadata.api.oclc.org/")[1].split(
"?"
)[0]
== "worldcat/manage/institution/holdings/850940548/unset"
)
assert unset_response.json()["action"] == "Unset Holdings"

def test_holdings_set_unset_marcxml(
self, yaml_params, method_params, stub_marc_xml
):
token = WorldcatAccessToken(
key=os.getenv("WCKEY"),
secret=os.getenv("WCSECRET"),
scopes=os.getenv("WCSCOPES"),
)

with MetadataSession(authorization=token) as session:
get_response = session.holdings_get_current("850940548")
holdings = get_response.json()["holdings"]
current_holding_endpoint_args = yaml_params(
get_response.request.url, get_response.request.method
)
current_holding_method_args = method_params(session.holdings_get_current)
assert current_holding_endpoint_args == current_holding_method_args

# make sure no holdings are set initially
if len(holdings) > 0:
session.holdings_unset_with_bib(
stub_marc_xml, recordFormat="application/marcxml+xml"
)

# test setting holdings
set_response = session.holdings_set_with_bib(
stub_marc_xml, recordFormat="application/marcxml+xml"
)
set_holding_endpoint_args = yaml_params(
set_response.request.url, set_response.request.method
)
set_holding_method_args = method_params(session.holdings_set_with_bib)
assert set_holding_endpoint_args == set_holding_method_args
assert (
set_response.url.split("https://metadata.api.oclc.org/")[1].split("?")[
0
]
== "worldcat/manage/institution/holdings/set"
)
assert set_response.status_code == 200
assert set_response.json()["action"] == "Set Holdings"

# test deleting holdings
unset_response = session.holdings_unset_with_bib(
stub_marc_xml, recordFormat="application/marcxml+xml"
)
unset_holding_endpoint_args = yaml_params(
unset_response.request.url, unset_response.request.method
)
unset_holding_method_args = method_params(session.holdings_unset_with_bib)
assert unset_holding_endpoint_args == unset_holding_method_args
assert unset_response.status_code == 200
assert (
unset_response.url.split("https://metadata.api.oclc.org/")[1].split(
"?"
)[0]
== "worldcat/manage/institution/holdings/unset"
)
assert unset_response.json()["action"] == "Unset Holdings"
# def test_holdings_set_unset(self, yaml_params, method_params):
# token = WorldcatAccessToken(
# key=os.getenv("WCKEY"),
# secret=os.getenv("WCSECRET"),
# scopes=os.getenv("WCSCOPES"),
# )

# with MetadataSession(authorization=token) as session:
# get_response = session.holdings_get_current("850940548")
# holdings = get_response.json()["holdings"]
# current_holding_endpoint_args = yaml_params(
# get_response.request.url, get_response.request.method
# )
# current_holding_method_args = method_params(session.holdings_get_current)
# assert current_holding_endpoint_args == current_holding_method_args

# # make sure no holdings are set initially
# if len(holdings) > 0:
# session.holdings_unset(850940548)

# # test setting holdings
# set_response = session.holdings_set(850940548)
# set_holding_endpoint_args = yaml_params(
# set_response.request.url, set_response.request.method
# )
# set_holding_method_args = method_params(session.holdings_set)
# assert set_holding_endpoint_args == set_holding_method_args
# assert (
# set_response.url.split("https://metadata.api.oclc.org/")[1].split("?")[
# 0
# ]
# == "worldcat/manage/institution/holdings/850940548/set"
# )
# assert set_response.status_code == 200
# assert set_response.json()["action"] == "Set Holdings"

# # test deleting holdings
# unset_response = session.holdings_unset(oclcNumber=850940548)
# unset_holding_endpoint_args = yaml_params(
# unset_response.request.url, unset_response.request.method
# )
# unset_holding_method_args = method_params(session.holdings_unset)
# assert unset_holding_endpoint_args == unset_holding_method_args
# assert unset_response.status_code == 200
# assert (
# unset_response.url.split("https://metadata.api.oclc.org/")[1].split(
# "?"
# )[0]
# == "worldcat/manage/institution/holdings/850940548/unset"
# )
# assert unset_response.json()["action"] == "Unset Holdings"

# def test_holdings_set_unset_marcxml(
# self, yaml_params, method_params, stub_marc_xml
# ):
# token = WorldcatAccessToken(
# key=os.getenv("WCKEY"),
# secret=os.getenv("WCSECRET"),
# scopes=os.getenv("WCSCOPES"),
# )

# with MetadataSession(authorization=token) as session:
# get_response = session.holdings_get_current("850940548")
# holdings = get_response.json()["holdings"]
# current_holding_endpoint_args = yaml_params(
# get_response.request.url, get_response.request.method
# )
# current_holding_method_args = method_params(session.holdings_get_current)
# assert current_holding_endpoint_args == current_holding_method_args

# # make sure no holdings are set initially
# if len(holdings) > 0:
# session.holdings_unset_with_bib(
# stub_marc_xml, recordFormat="application/marcxml+xml"
# )

# # test setting holdings
# set_response = session.holdings_set_with_bib(
# stub_marc_xml, recordFormat="application/marcxml+xml"
# )
# set_holding_endpoint_args = yaml_params(
# set_response.request.url, set_response.request.method
# )
# set_holding_method_args = method_params(session.holdings_set_with_bib)
# assert set_holding_endpoint_args == set_holding_method_args
# assert (
# set_response.url.split("https://metadata.api.oclc.org/")[1].split("?")[
# 0
# ]
# == "worldcat/manage/institution/holdings/set"
# )
# assert set_response.status_code == 200
# assert set_response.json()["action"] == "Set Holdings"

# # test deleting holdings
# unset_response = session.holdings_unset_with_bib(
# stub_marc_xml, recordFormat="application/marcxml+xml"
# )
# unset_holding_endpoint_args = yaml_params(
# unset_response.request.url, unset_response.request.method
# )
# unset_holding_method_args = method_params(session.holdings_unset_with_bib)
# assert unset_holding_endpoint_args == unset_holding_method_args
# assert unset_response.status_code == 200
# assert (
# unset_response.url.split("https://metadata.api.oclc.org/")[1].split(
# "?"
# )[0]
# == "worldcat/manage/institution/holdings/unset"
# )
# assert unset_response.json()["action"] == "Unset Holdings"

def test_summary_holdings_get(self, yaml_params, method_params):
token = WorldcatAccessToken(
Expand Down

0 comments on commit 3dc2268

Please sign in to comment.