test fixes resulting from change in keys

pull/2098/head
damon 2020-06-17 11:31:48 -07:00
parent 9d65b242e8
commit 6d79d8db7b
6 changed files with 14 additions and 11 deletions

View File

@ -17,11 +17,12 @@ COPY ./nucypher/blockchain/eth/sol/__conf__.py /install/nucypher/blockchain/eth/
COPY scripts/installation/install_solc.py /install/scripts/installation/
COPY dev-requirements.txt /install
COPY requirements.txt /install
COPY docs-requirements.txt /install
COPY dev/docker/scripts/install/entrypoint.sh /install
# install reqs and solc
RUN pip install --upgrade pip
RUN pip3 install -r /install/dev-requirements.txt --src /usr/local/src
RUN pip3 install .[dev] --src /usr/local/src
RUN pip3 install ipdb
# puts the nucypher executable in bin path

View File

@ -52,13 +52,13 @@ class EncryptMessage(BaseSchema):
we output one of them as the "plaintext" arg to enrico.encrypt_message
"""
if data['message'] and data['filepath']:
if data.get('message') and data.get('filepath'):
raise exceptions.InvalidArgumentCombo("choose either a message or a filepath but not both.")
if data.get('message'):
data = bytes(data.get('message'), encoding='utf-8')
data = bytes(data['message'], encoding='utf-8')
else:
data = data.get('filepath')
data = data['filepath']
return {"plaintext": data}

View File

@ -36,9 +36,12 @@ from nucypher.utilities.prometheus.collector import (
import json
from typing import List
from prometheus_client.core import Timestamp
from prometheus_client.registry import CollectorRegistry, REGISTRY
from prometheus_client.utils import floatToGoString
try:
from prometheus_client.core import Timestamp
from prometheus_client.registry import CollectorRegistry, REGISTRY
from prometheus_client.utils import floatToGoString
except ImportError:
raise DevelopmentInstallationRequired(importable_name='prometheus_client')
from twisted.internet import reactor, task
from twisted.web.resource import Resource

View File

@ -144,6 +144,6 @@ def retrieve_control_request(federated_bob, enacted_federated_policy, capsule_si
def encrypt_control_request():
method_name = 'encrypt_message'
params = {
'plaintext': b64encode(b"The admiration I had for your work has completely evaporated!").decode(),
'message': b64encode(b"The admiration I had for your work has completely evaporated!").decode(),
}
return method_name, params

View File

@ -230,7 +230,6 @@ def test_bob_web_character_control_retrieve_again(bob_web_controller_test_client
def test_enrico_web_character_control_encrypt_message(enrico_web_controller_test_client, encrypt_control_request):
method_name, params = encrypt_control_request
endpoint = f'/{method_name}'
response = enrico_web_controller_test_client.post(endpoint, data=json.dumps(params))
assert response.status_code == 200
@ -245,7 +244,7 @@ def test_enrico_web_character_control_encrypt_message(enrico_web_controller_test
response = enrico_web_controller_test_client.post('/encrypt_message', data=json.dumps({'bad': 'input'}))
assert response.status_code == 400
del(params['plaintext'])
del(params['message'])
response = enrico_web_controller_test_client.post('/encrypt_message', data=params)
assert response.status_code == 400

View File

@ -65,7 +65,7 @@ def test_message_kit_serialization_via_enrico(enacted_federated_policy, federate
plaintext_bytes = bytes(message, encoding='utf-8')
# Create
message_kit, signature = enrico.encrypt_message(message=plaintext_bytes)
message_kit, signature = enrico.encrypt_message(plaintext=plaintext_bytes)
# Serialize
message_kit_bytes = message_kit.to_bytes()