-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove inetd implementation of update and add http endpoints for upda…
…te and restart to api server
- Loading branch information
Showing
11 changed files
with
141 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ venv/ | |
env/ | ||
.env/ | ||
|
||
build/ | ||
api/docs/build/ | ||
develop-eggs/ | ||
dist/ | ||
|
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
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,54 @@ | ||
import os | ||
import json | ||
import tempfile | ||
from aiohttp import web | ||
from opentrons.server.main import init, log_init | ||
from opentrons.server import endpoints | ||
|
||
|
||
async def test_restart(virtual_smoothie_env, monkeypatch, loop, test_client): | ||
test_data = {"test": "pass"} | ||
|
||
async def mock_restart(request): | ||
return web.json_response(test_data) | ||
monkeypatch.setattr(endpoints, 'restart', mock_restart) | ||
|
||
app = init(loop) | ||
cli = await loop.create_task(test_client(app)) | ||
|
||
expected = json.dumps(test_data) | ||
resp = await cli.post('/server/restart') | ||
text = await resp.text() | ||
assert resp.status == 200 | ||
assert text == expected | ||
|
||
|
||
async def test_update(virtual_smoothie_env, monkeypatch, loop, test_client): | ||
log_init() | ||
|
||
msg = "success" | ||
filename = "testy.whl" | ||
tmpdir = tempfile.mkdtemp("files") | ||
with open(os.path.join(tmpdir, filename), 'w') as fd: | ||
fd.write("test") | ||
|
||
async def mock_install(filename, loop): | ||
return msg | ||
monkeypatch.setattr(endpoints, '_install', mock_install) | ||
|
||
app = init(loop) | ||
cli = await loop.create_task(test_client(app)) | ||
|
||
data = {'whl': open(os.path.join(tmpdir, filename))} | ||
|
||
resp = await cli.post( | ||
'/server/update', | ||
data=data) | ||
|
||
expected = json.dumps({ | ||
'message': msg, | ||
'filename': filename | ||
}) | ||
text = await resp.text() | ||
assert resp.status == 200 | ||
assert text == expected |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
local-ethernet:ssh stream tcp6 nowait root /usr/sbin/dropbear dropbear -Bi | ||
localhost:http stream tcp nowait root /usr/local/bin/updates.sh updates.sh |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.