destiny_sdk 0.2.3__tar.gz → 0.3.0a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/PKG-INFO +1 -1
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/pyproject.toml +1 -1
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/client.py +2 -24
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/robots.py +25 -122
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_client.py +3 -3
- destiny_sdk-0.3.0a0/tests/unit/test_robots.py +29 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/uv.lock +1 -1
- destiny_sdk-0.2.3/tests/unit/test_robots.py +0 -61
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/.gitignore +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/LICENSE +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/README.md +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/__init__.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/auth.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/core.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/enhancements.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/identifiers.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/imports.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/parsers/__init__.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/parsers/eppi_parser.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/py.typed +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/references.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/src/destiny_sdk/visibility.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/__init__.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/conftest.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/parsers/test_eppi_parser.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_auth.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_data/eppi_import.jsonl +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_data/eppi_import_with_annotations.jsonl +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_data/eppi_report.json +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_enhancements.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_identifiers.py +0 -0
- {destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_references.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: destiny_sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0a0
|
|
4
4
|
Summary: A software development kit (sdk) to support interaction with the DESTINY repository
|
|
5
5
|
Author-email: Adam Hamilton <adam@futureevidence.org>, Andrew Harvey <andrew@futureevidence.org>, Daniel Breves <daniel@futureevidence.org>, Jack Walmisley <jack@futureevidence.org>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -7,8 +7,6 @@ import httpx
|
|
|
7
7
|
from pydantic import UUID4, HttpUrl
|
|
8
8
|
|
|
9
9
|
from destiny_sdk.robots import (
|
|
10
|
-
BatchEnhancementRequestRead,
|
|
11
|
-
BatchRobotResult,
|
|
12
10
|
EnhancementRequestRead,
|
|
13
11
|
RobotResult,
|
|
14
12
|
)
|
|
@@ -80,34 +78,14 @@ class Client:
|
|
|
80
78
|
|
|
81
79
|
Signs the request with the client's secret key.
|
|
82
80
|
|
|
83
|
-
:param robot_result: The
|
|
81
|
+
:param robot_result: The RobotResult to send
|
|
84
82
|
:type robot_result: RobotResult
|
|
85
83
|
:return: The EnhancementRequestRead object from the response.
|
|
86
84
|
:rtype: EnhancementRequestRead
|
|
87
85
|
"""
|
|
88
86
|
response = self.session.post(
|
|
89
|
-
f"/enhancement-requests/
|
|
87
|
+
f"/enhancement-requests/{robot_result.request_id}/results/",
|
|
90
88
|
json=robot_result.model_dump(mode="json"),
|
|
91
89
|
)
|
|
92
90
|
response.raise_for_status()
|
|
93
91
|
return EnhancementRequestRead.model_validate(response.json())
|
|
94
|
-
|
|
95
|
-
def send_batch_robot_result(
|
|
96
|
-
self, batch_robot_result: BatchRobotResult
|
|
97
|
-
) -> BatchEnhancementRequestRead:
|
|
98
|
-
"""
|
|
99
|
-
Send a BatchRobotResult to destiny repository.
|
|
100
|
-
|
|
101
|
-
Signs the request with the client's secret key.
|
|
102
|
-
|
|
103
|
-
:param batch_robot_result: The Batch Robot Result to send
|
|
104
|
-
:type batch_robot_result: BatchRobotResult
|
|
105
|
-
:return: The BatchEnhancementRequestRead object from the response.
|
|
106
|
-
:rtype: BatchEnhancementRequestRead
|
|
107
|
-
"""
|
|
108
|
-
response = self.session.post(
|
|
109
|
-
f"/enhancement-requests/batch-requests/{batch_robot_result.request_id}/results/",
|
|
110
|
-
json=batch_robot_result.model_dump(mode="json"),
|
|
111
|
-
)
|
|
112
|
-
response.raise_for_status()
|
|
113
|
-
return BatchEnhancementRequestRead.model_validate(response.json())
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"""Schemas that define inputs/outputs for robots."""
|
|
2
2
|
|
|
3
3
|
from enum import StrEnum, auto
|
|
4
|
-
from typing import Annotated, Any
|
|
4
|
+
from typing import Annotated, Any
|
|
5
5
|
|
|
6
|
-
from pydantic import UUID4, BaseModel, ConfigDict, Field, HttpUrl
|
|
6
|
+
from pydantic import UUID4, BaseModel, ConfigDict, Field, HttpUrl
|
|
7
7
|
|
|
8
8
|
from destiny_sdk.core import _JsonlFileInputMixIn
|
|
9
9
|
from destiny_sdk.enhancements import Enhancement
|
|
10
|
-
from destiny_sdk.references import Reference
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
class RobotError(BaseModel):
|
|
@@ -37,29 +36,6 @@ class LinkedRobotError(_JsonlFileInputMixIn, RobotError):
|
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
class RobotResult(BaseModel):
|
|
40
|
-
"""The result of a robot request which is returned to the repo."""
|
|
41
|
-
|
|
42
|
-
request_id: UUID4
|
|
43
|
-
error: RobotError | None = Field(
|
|
44
|
-
default=None,
|
|
45
|
-
description="Error the robot encountered while creating enhancement.",
|
|
46
|
-
)
|
|
47
|
-
enhancement: Enhancement | None = Field(
|
|
48
|
-
default=None, description="An enhancement to create"
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
@model_validator(mode="after")
|
|
52
|
-
def validate_error_or_enhancement_set(self) -> Self:
|
|
53
|
-
"""Validate that a robot result has either an error or an enhancement set."""
|
|
54
|
-
if (self.error is None) == (self.enhancement is None):
|
|
55
|
-
msg = """
|
|
56
|
-
exactly one of 'error' or 'enhancement' must be provided
|
|
57
|
-
"""
|
|
58
|
-
raise ValueError(msg)
|
|
59
|
-
return self
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class BatchRobotResult(BaseModel):
|
|
63
39
|
"""Used to indicate to the repository that the robot has finished processing."""
|
|
64
40
|
|
|
65
41
|
request_id: UUID4
|
|
@@ -67,7 +43,8 @@ class BatchRobotResult(BaseModel):
|
|
|
67
43
|
default=None,
|
|
68
44
|
description="""
|
|
69
45
|
Error the robot encountered while creating enhancements. If this field is populated,
|
|
70
|
-
we assume the entire
|
|
46
|
+
we assume the entire enhancement request or http request request failed,
|
|
47
|
+
rather than an individual reference.
|
|
71
48
|
If there was an error with processing an individual reference, it should be passed in
|
|
72
49
|
the result file and this field should be left as None. Vice-versa, if this field is
|
|
73
50
|
None, the repository will assume that the result file is ready for processing.
|
|
@@ -75,14 +52,14 @@ None, the repository will assume that the result file is ready for processing.
|
|
|
75
52
|
)
|
|
76
53
|
|
|
77
54
|
|
|
78
|
-
class
|
|
55
|
+
class RobotResultValidationEntry(_JsonlFileInputMixIn, BaseModel):
|
|
79
56
|
"""A single entry in the validation result file for a batch enhancement request."""
|
|
80
57
|
|
|
81
58
|
reference_id: UUID4 | None = Field(
|
|
82
59
|
default=None,
|
|
83
60
|
description=(
|
|
84
61
|
"The ID of the reference which was enhanced. "
|
|
85
|
-
"If this is empty, the
|
|
62
|
+
"If this is empty, the EnhancementResultEntry could not be parsed."
|
|
86
63
|
),
|
|
87
64
|
)
|
|
88
65
|
error: str | None = Field(
|
|
@@ -94,30 +71,15 @@ class BatchRobotResultValidationEntry(_JsonlFileInputMixIn, BaseModel):
|
|
|
94
71
|
)
|
|
95
72
|
|
|
96
73
|
|
|
97
|
-
|
|
98
|
-
"""An enhancement request from the repo to a robot."""
|
|
99
|
-
|
|
100
|
-
id: UUID4
|
|
101
|
-
reference: Reference = Field(
|
|
102
|
-
description=(
|
|
103
|
-
"Reference to be enhanced, includes identifiers and existing enhancments."
|
|
104
|
-
)
|
|
105
|
-
)
|
|
106
|
-
extra_fields: dict | None = Field(
|
|
107
|
-
default=None,
|
|
108
|
-
description="Extra fields to pass to the robot. TBC.",
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
#: The result for a single reference when processed by a batch enhancement request.
|
|
74
|
+
#: The result for a single reference when processed by an enhancement request.
|
|
113
75
|
#: This is a single entry in the result file.
|
|
114
|
-
|
|
76
|
+
EnhancementResultEntry = Annotated[
|
|
115
77
|
Enhancement | LinkedRobotError,
|
|
116
78
|
Field(),
|
|
117
79
|
]
|
|
118
80
|
|
|
119
81
|
|
|
120
|
-
class
|
|
82
|
+
class RobotRequest(BaseModel):
|
|
121
83
|
"""A batch enhancement request from the repo to a robot."""
|
|
122
84
|
|
|
123
85
|
id: UUID4
|
|
@@ -130,16 +92,16 @@ reference per line.
|
|
|
130
92
|
Each reference may have identifiers or enhancements attached, as
|
|
131
93
|
required by the robot.
|
|
132
94
|
If the URL expires, a new one can be generated using
|
|
133
|
-
``GET /
|
|
95
|
+
``GET /enhancement-requests/{request_id}/``.
|
|
134
96
|
"""
|
|
135
97
|
)
|
|
136
98
|
result_storage_url: HttpUrl = Field(
|
|
137
99
|
description="""
|
|
138
100
|
The URL at which the set of enhancements are to be stored. The file is to be a jsonl
|
|
139
101
|
with each line formatted according to
|
|
140
|
-
:class:`
|
|
102
|
+
:class:`EnhancementResultEntry <libs.sdk.src.destiny_sdk.robots.EnhancementResultEntry>`.
|
|
141
103
|
If the URL expires, a new one can be generated using
|
|
142
|
-
``GET /
|
|
104
|
+
``GET /enhancement-requests/{request_id}/``.
|
|
143
105
|
""" # noqa: E501
|
|
144
106
|
)
|
|
145
107
|
extra_fields: dict | None = Field(
|
|
@@ -152,64 +114,6 @@ class EnhancementRequestStatus(StrEnum):
|
|
|
152
114
|
"""
|
|
153
115
|
The status of an enhancement request.
|
|
154
116
|
|
|
155
|
-
**Allowed values**:
|
|
156
|
-
- `received`: Enhancement request has been received.
|
|
157
|
-
- `accepted`: Enhancement request has been accepted.
|
|
158
|
-
- `rejected`: Enhancement request has been rejected.
|
|
159
|
-
- `failed`: Enhancement failed to create.
|
|
160
|
-
- `completed`: Enhancement has been created.
|
|
161
|
-
"""
|
|
162
|
-
|
|
163
|
-
RECEIVED = auto()
|
|
164
|
-
ACCEPTED = auto()
|
|
165
|
-
REJECTED = auto()
|
|
166
|
-
FAILED = auto()
|
|
167
|
-
COMPLETED = auto()
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
class _EnhancementRequestBase(BaseModel):
|
|
171
|
-
"""
|
|
172
|
-
Base enhancement request class.
|
|
173
|
-
|
|
174
|
-
An enhancement request is a request to create an enhancement on a reference.
|
|
175
|
-
It contains the reference and the robot to be used to create the enhancement.
|
|
176
|
-
"""
|
|
177
|
-
|
|
178
|
-
reference_id: UUID4 = Field(description="The ID of the reference to be enhanced.")
|
|
179
|
-
robot_id: UUID4 = Field(
|
|
180
|
-
description="The robot to be used to create the enhancement."
|
|
181
|
-
)
|
|
182
|
-
source: str | None = Field(
|
|
183
|
-
default=None,
|
|
184
|
-
description="The source of the batch enhancement request.",
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
enhancement_parameters: dict | None = Field(
|
|
188
|
-
default=None, description="Information needed to create the enhancement. TBC."
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
class EnhancementRequestIn(_EnhancementRequestBase):
|
|
193
|
-
"""The model for requesting an enhancement on specific reference."""
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
class EnhancementRequestRead(_EnhancementRequestBase):
|
|
197
|
-
"""Core enhancement request class."""
|
|
198
|
-
|
|
199
|
-
id: UUID4
|
|
200
|
-
request_status: EnhancementRequestStatus = Field(
|
|
201
|
-
description="The status of the request to create an enhancement",
|
|
202
|
-
)
|
|
203
|
-
error: str | None = Field(
|
|
204
|
-
default=None,
|
|
205
|
-
description="Error encountered during the enhancement process",
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
class BatchEnhancementRequestStatus(StrEnum):
|
|
210
|
-
"""
|
|
211
|
-
The status of an enhancement request.
|
|
212
|
-
|
|
213
117
|
**Allowed values**:
|
|
214
118
|
- `received`: Enhancement request has been received by the repo.
|
|
215
119
|
- `accepted`: Enhancement request has been accepted by the robot.
|
|
@@ -233,11 +137,11 @@ class BatchEnhancementRequestStatus(StrEnum):
|
|
|
233
137
|
COMPLETED = auto()
|
|
234
138
|
|
|
235
139
|
|
|
236
|
-
class
|
|
140
|
+
class _EnhancementRequestBase(BaseModel):
|
|
237
141
|
"""
|
|
238
|
-
Base
|
|
142
|
+
Base enhancement request class.
|
|
239
143
|
|
|
240
|
-
A
|
|
144
|
+
A enhancement request is a request to create one or more enhancements.
|
|
241
145
|
"""
|
|
242
146
|
|
|
243
147
|
robot_id: UUID4 = Field(
|
|
@@ -252,15 +156,15 @@ class _BatchEnhancementRequestBase(BaseModel):
|
|
|
252
156
|
)
|
|
253
157
|
|
|
254
158
|
|
|
255
|
-
class
|
|
159
|
+
class EnhancementRequestIn(_EnhancementRequestBase):
|
|
256
160
|
"""The model for requesting multiple enhancements on specific references."""
|
|
257
161
|
|
|
258
162
|
|
|
259
|
-
class
|
|
163
|
+
class EnhancementRequestRead(_EnhancementRequestBase):
|
|
260
164
|
"""Core batch enhancement request class."""
|
|
261
165
|
|
|
262
166
|
id: UUID4
|
|
263
|
-
request_status:
|
|
167
|
+
request_status: EnhancementRequestStatus = Field(
|
|
264
168
|
description="The status of the request to create enhancements",
|
|
265
169
|
)
|
|
266
170
|
reference_data_url: HttpUrl | None = Field(
|
|
@@ -273,7 +177,7 @@ formatted according to
|
|
|
273
177
|
Each reference may have identifiers or enhancements attached, as
|
|
274
178
|
required by the robot.
|
|
275
179
|
If the URL expires, a new one can be generated using
|
|
276
|
-
``GET /
|
|
180
|
+
``GET /enhancement-requests/{request_id}/``.
|
|
277
181
|
""",
|
|
278
182
|
)
|
|
279
183
|
result_storage_url: HttpUrl | None = Field(
|
|
@@ -281,26 +185,26 @@ If the URL expires, a new one can be generated using
|
|
|
281
185
|
description="""
|
|
282
186
|
The URL at which the set of enhancements are stored. The file is to be a jsonl
|
|
283
187
|
with each line formatted according to
|
|
284
|
-
:class:`
|
|
188
|
+
:class:`EnhancementResultEntry <libs.sdk.src.destiny_sdk.robots.EnhancementResultEntry>`.
|
|
285
189
|
This field is only relevant to robots.
|
|
286
190
|
If the URL expires, a new one can be generated using
|
|
287
|
-
``GET /
|
|
191
|
+
``GET /enhancement-requests/{request_id}/``.
|
|
288
192
|
""", # noqa: E501
|
|
289
193
|
)
|
|
290
194
|
validation_result_url: HttpUrl | None = Field(
|
|
291
195
|
default=None,
|
|
292
196
|
description="""
|
|
293
|
-
The URL at which the result of the
|
|
197
|
+
The URL at which the result of the enhancement request is stored.
|
|
294
198
|
This file is a txt file, one line per reference, with either an error
|
|
295
199
|
or a success message.
|
|
296
200
|
If the URL expires, a new one can be generated using
|
|
297
|
-
``GET /
|
|
201
|
+
``GET /enhancement-requests/{request_id}/``.
|
|
298
202
|
""",
|
|
299
203
|
)
|
|
300
204
|
error: str | None = Field(
|
|
301
205
|
default=None,
|
|
302
206
|
description="Error encountered during the enhancement process. This "
|
|
303
|
-
"is only used if the entire
|
|
207
|
+
"is only used if the entire enhancement request failed, rather than an "
|
|
304
208
|
"individual reference. If there was an error with processing an individual "
|
|
305
209
|
"reference, it is passed in the validation result file.",
|
|
306
210
|
)
|
|
@@ -317,8 +221,7 @@ class _RobotBase(BaseModel):
|
|
|
317
221
|
|
|
318
222
|
name: str = Field(description="The name of the robot, must be unique.")
|
|
319
223
|
base_url: HttpUrl = Field(
|
|
320
|
-
description="The base url of the robot. The robot must implement
|
|
321
|
-
"base_url/single for the enhancement of single references and "
|
|
224
|
+
description="The base url of the robot. The robot must implement endpoint"
|
|
322
225
|
"base_url/batch for batch enhancements of references.",
|
|
323
226
|
)
|
|
324
227
|
description: str = Field(
|
|
@@ -24,11 +24,11 @@ def test_verify_hmac_headers_sent(httpx_mock: HTTPXMock, frozen_time) -> None:
|
|
|
24
24
|
fake_destiny_repository_url = "https://www.destiny-repository-lives-here.co.au/v1"
|
|
25
25
|
|
|
26
26
|
fake_robot_result = RobotResult(
|
|
27
|
-
request_id=uuid.uuid4(), error=RobotError(message="
|
|
27
|
+
request_id=uuid.uuid4(), error=RobotError(message="Cannot process this batch")
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
expected_response_body = EnhancementRequestRead(
|
|
31
|
-
|
|
31
|
+
reference_ids=[uuid.uuid4()],
|
|
32
32
|
id=uuid.uuid4(),
|
|
33
33
|
robot_id=uuid.uuid4(),
|
|
34
34
|
request_status="failed",
|
|
@@ -43,7 +43,7 @@ def test_verify_hmac_headers_sent(httpx_mock: HTTPXMock, frozen_time) -> None:
|
|
|
43
43
|
|
|
44
44
|
httpx_mock.add_response(
|
|
45
45
|
url=fake_destiny_repository_url
|
|
46
|
-
+ "/enhancement-requests/
|
|
46
|
+
+ "/enhancement-requests/"
|
|
47
47
|
+ f"{fake_robot_result.request_id}/results/",
|
|
48
48
|
method="POST",
|
|
49
49
|
match_headers={
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
|
|
3
|
+
import destiny_sdk
|
|
4
|
+
import pytest
|
|
5
|
+
from pydantic import HttpUrl, ValidationError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_provisioned_robot_valid():
|
|
9
|
+
provisioned_robot = destiny_sdk.robots.ProvisionedRobot(
|
|
10
|
+
id=uuid.uuid4(),
|
|
11
|
+
base_url=HttpUrl("https://www.domo-arigato-mr-robo.to"),
|
|
12
|
+
name="Mr. Roboto",
|
|
13
|
+
description="I have come to help you with your problems",
|
|
14
|
+
owner="Styx",
|
|
15
|
+
client_secret="secret, secret, I've got a secret",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
assert provisioned_robot.owner == "Styx"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_robot_models_reject_any_extra_fields():
|
|
22
|
+
with pytest.raises(ValidationError):
|
|
23
|
+
destiny_sdk.robots.Robot(
|
|
24
|
+
base_url=HttpUrl("https://www.domo-arigato-mr-robo.to"),
|
|
25
|
+
name="Mr. Roboto",
|
|
26
|
+
description="I have come to help you with your problems",
|
|
27
|
+
owner="Styx",
|
|
28
|
+
client_secret="I'm not allowed in this model",
|
|
29
|
+
)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import uuid
|
|
2
|
-
|
|
3
|
-
import destiny_sdk
|
|
4
|
-
import pytest
|
|
5
|
-
from pydantic import HttpUrl, ValidationError
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_enhancement_request_valid():
|
|
9
|
-
enhancement_request = destiny_sdk.robots.EnhancementRequestRead(
|
|
10
|
-
id=uuid.uuid4(),
|
|
11
|
-
reference_id=uuid.uuid4(),
|
|
12
|
-
reference=destiny_sdk.references.Reference(
|
|
13
|
-
id=uuid.uuid4(), visibility=destiny_sdk.visibility.Visibility.RESTRICTED
|
|
14
|
-
),
|
|
15
|
-
robot_id=uuid.uuid4(),
|
|
16
|
-
request_status=destiny_sdk.robots.EnhancementRequestStatus.RECEIVED,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
assert (
|
|
20
|
-
enhancement_request.request_status
|
|
21
|
-
== destiny_sdk.robots.EnhancementRequestStatus.RECEIVED
|
|
22
|
-
)
|
|
23
|
-
assert enhancement_request.enhancement_parameters is None
|
|
24
|
-
assert enhancement_request.error is None
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def test_provisioned_robot_valid():
|
|
28
|
-
provisioned_robot = destiny_sdk.robots.ProvisionedRobot(
|
|
29
|
-
id=uuid.uuid4(),
|
|
30
|
-
base_url=HttpUrl("https://www.domo-arigato-mr-robo.to"),
|
|
31
|
-
name="Mr. Roboto",
|
|
32
|
-
description="I have come to help you with your problems",
|
|
33
|
-
owner="Styx",
|
|
34
|
-
client_secret="secret, secret, I've got a secret",
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
assert provisioned_robot.owner == "Styx"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def test_robot_models_reject_any_extra_fields():
|
|
41
|
-
with pytest.raises(ValidationError):
|
|
42
|
-
destiny_sdk.robots.Robot(
|
|
43
|
-
base_url=HttpUrl("https://www.domo-arigato-mr-robo.to"),
|
|
44
|
-
name="Mr. Roboto",
|
|
45
|
-
description="I have come to help you with your problems",
|
|
46
|
-
owner="Styx",
|
|
47
|
-
client_secret="I'm not allowed in this model",
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def test_robot_request_does_not_require_extra_fields():
|
|
52
|
-
reference = destiny_sdk.references.Reference(
|
|
53
|
-
id=uuid.uuid4(), visibility=destiny_sdk.visibility.Visibility.RESTRICTED
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
# Don't pass any extra fields
|
|
57
|
-
robot_request = destiny_sdk.robots.RobotRequest(
|
|
58
|
-
id=uuid.uuid4(), reference=reference
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
assert not robot_request.extra_fields
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{destiny_sdk-0.2.3 → destiny_sdk-0.3.0a0}/tests/unit/test_data/eppi_import_with_annotations.jsonl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|