Skip to content

Commit a5bda2a

Browse files
Adding local testing (#55)
1 parent 9d64382 commit a5bda2a

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

.env_example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
API_HOST=
2+
API_KEY=

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,31 @@ with lilt.ApiClient(configuration) as api_client:
117117

118118
```
119119

120+
## Checking Credentials
121+
122+
If you would like to test your credentials using our functionality tests you can do the following. Run:
123+
124+
```sh
125+
pip show lilt-python
126+
```
127+
128+
Navigate to the Location field and create a .env file inside the package using .env_example as a template. Fill out the API_HOST and API_KEY lines using the credentials you were given.
129+
130+
Then while inside the package folder, run:
131+
132+
```sh
133+
pip install -r test-requirements.txt
134+
```
135+
136+
Followed by:
137+
138+
```sh
139+
local_test
140+
```
141+
142+
You should be able to see the tests run.
143+
144+
120145
## Documentation for API Endpoints
121146

122147
All URIs are relative to *https://api.lilt.com*

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
include_package_data=True,
3737
long_description="""\
3838
Lilt REST API Support: https://lilt.atlassian.net/servicedesk/customer/portals The Lilt REST API enables programmatic access to the full-range of Lilt backend services including: * Training of and translating with interactive, adaptive machine translation * Large-scale translation memory * The Lexicon (a large-scale termbase) * Programmatic control of the Lilt CAT environment * Translation memory synchronization Requests and responses are in JSON format. The REST API only responds to HTTPS / SSL requests. The base url for this REST API is `https://api.lilt.com/`. ## Authentication Requests are authenticated via REST API key, which requires the Business plan. Requests are authenticated using [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication). Add your REST API key as both the `username` and `password`. For development, you may also pass the REST API key via the `key` query parameter. This is less secure than HTTP Basic Auth, and is not recommended for production use. ## Quotas Our services have a general quota of 4000 requests per minute. Should you hit the maximum requests per minute, you will need to wait 60 seconds before you can send another request. # noqa: E501
39-
"""
39+
""",
40+
entry_points = {
41+
'console_scripts': ['local_test=workflow_tests.local_test:main']
42+
}
4043
)

workflow_tests/local_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import pytest
2+
3+
def main():
4+
retcode = pytest.main(["workflow_tests"])

0 commit comments

Comments
 (0)