Skip to content

Commit de6c25c

Browse files
committed
Update create test to include HOSTNAME
Changes to be committed: modified: config/services.py modified: tests/test_apis/test_biocompute/test_objects_drafts_create.py
1 parent f2a4044 commit de6c25c

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

config/services.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ def legacy_api_converter(data:dict) ->dict:
7979
return new_data
8080

8181
def response_constructor(
82-
identifier: str,
83-
status: str,
84-
code: str,
85-
message: str=None,
86-
data: dict= None
82+
identifier: str,
83+
status: str,
84+
code: str,
85+
message: str=None,
86+
data: dict= None
8787
)-> dict:
8888

8989
"""Constructs a structured response dictionary.

tests/test_apis/test_biocompute/test_objects_drafts_create.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99

1010
import json
1111
from django.test import TestCase
12+
from django.conf import settings
1213
from django.contrib.auth.models import User
1314
from rest_framework.authtoken.models import Token
1415
from rest_framework.test import APIClient
1516
from tests.fixtures.testing_bcos import BCO_000001_DRAFT
1617

18+
19+
HOSTNAME = settings.PUBLIC_HOSTNAME
20+
1721
class BcoDraftCreateTestCase(TestCase):
1822
fixtures = ['tests/fixtures/test_data']
1923
def setUp(self):
@@ -26,10 +30,10 @@ def setUp(self):
2630
{
2731
"prefix": "NOPUB",
2832
"owner_group": "tester",
29-
"object_id": "http://127.0.0.1:8000/NOPUB_000002/DRAFT",
33+
"object_id": f"{HOSTNAME}/NOPUB_000002/DRAFT",
3034
"schema": "IEEE",
3135
"contents": {
32-
"object_id": "http://127.0.0.1:8000/NOPUB_000002/DRAFT",
36+
"object_id": f"{HOSTNAME}/NOPUB_000002/DRAFT",
3337
"spec_version": "https://w3id.org/ieee/ieee-2791-schema/2791object.json",
3438
"etag": "11ee4c3b8a04ad16dcca19a6f478c0870d3fe668ed6454096ab7165deb1ab8ea"
3539
}
@@ -44,10 +48,10 @@ def setUp(self):
4448
"contents": BCO_000001_DRAFT
4549
},
4650
{
47-
"object_id": "http://127.0.0.1:8000/TEST_000003/DRAFT",
51+
"object_id": f"{HOSTNAME}/TEST_000003/DRAFT",
4852
"prefix": "TEST",
4953
"contents": {
50-
"object_id": "https://biocomputeobject.org/TEST_000003/DRAFT",
54+
"object_id": f"{HOSTNAME}/TEST_000003/DRAFT",
5155
"spec_version": "https://w3id.org/ieee/ieee-2791-schema/2791object.json",
5256
"etag": "11ee4c3b8a04ad16dcca19a6f478c0870d3fe668ed6454096ab7165deb1ab8ea"
5357
}
@@ -80,7 +84,7 @@ def test_partial_failure(self):
8084
'owner_group': 'bco_drafter',
8185
'schema': 'IEEE',
8286
'contents': {
83-
"object_id": "https://biocomputeobject.org/BCO_000005",
87+
"object_id": f"{HOSTNAME}/BCO_000005",
8488
"spec_version": "https://w3id.org/ieee/ieee-2791-schema/2791object.json",
8589
"etag": "11ee4c3b8a04ad16dcca19a6f478c0870d3fe668ed6454096ab7165deb1ab8ea"
8690
}
@@ -102,10 +106,10 @@ def test_bad_request(self):
102106
Gives 403 forbidden request instead of 400'''
103107
data = [
104108
{
105-
"object_id": "http://127.0.0.1:8000/TEST_000001",
109+
"object_id": f"{HOSTNAME}/TEST_000001",
106110
# "prefix": "TEST",
107111
"contents": {
108-
"object_id": "https://biocomputeobject.org/TEST_000001",
112+
"object_id": f"{HOSTNAME}/TEST_000001",
109113
"spec_version": "https://w3id.org/ieee/ieee-2791-schema/2791object.json",
110114
"etag": "11ee4c3b8a04ad16dcca19a6f478c0870d3fe668ed6454096ab7165deb1ab8ea",
111115
}

0 commit comments

Comments
 (0)