-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated readme to include example server responses. (#24)
* Updated readme to include example server responses. * Added redis server and explicit tests. * Fixed error in redis test. * Updated redis hostname to redis. * Added port forwarding to github actions.
- Loading branch information
Showing
8 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import json | ||
import logging | ||
from unittest import TestCase | ||
|
||
import redis | ||
|
||
import SciXHarvester.API.harvester_server as hs | ||
from harvester.db import write_status_redis | ||
|
||
|
||
class TestRedisReadWrite(TestCase): | ||
def test_redis_read_write(self): | ||
listener = hs.Listener() | ||
listener.subscribe() | ||
job_id = "1234234215" | ||
status = "Success" | ||
logger = hs.Logging(logging) | ||
redis_status = json.dumps({"job_id": job_id, "status": status}) | ||
redis_instance = redis.StrictRedis( | ||
"localhost", | ||
6379, | ||
decode_responses=True, | ||
) | ||
write_status_redis(redis_instance, redis_status) | ||
status = next(listener.get_status_redis(job_id, logger.logger)) | ||
print(status) | ||
self.assertEqual(status, status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters