Skip to content

Commit

Permalink
Merge 702b580 into 430b67c
Browse files Browse the repository at this point in the history
  • Loading branch information
wochinge committed Nov 22, 2018
2 parents 430b67c + 702b580 commit cd674f8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -30,6 +30,8 @@ Fixed
- Should loading jieba custom dictionaries only once.
- Set attributes of custom components correctly if they defer from the default
- NLU Server can now handle training data mit emojis in it
- If the ``token_name`` is not given in the endpoint configuration, the default
value is ``token`` instead of ``None`
[0.13.8] - 2018-11-21
^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -39,7 +41,7 @@ Fixed
- pinned spacy version to ``spacy<=2.0.12,>2.0`` to avoid dependency conflicts
with tensorflow

[0.13.7] - 2018-10-11
[0.13.7] - 2018-10-11`
^^^^^^^^^^^^^^^^^^^^^

Fixed
Expand Down
8 changes: 2 additions & 6 deletions rasa_nlu/utils/__init__.py
Expand Up @@ -497,12 +497,8 @@ def request(self,
@classmethod
def from_dict(cls, data):
return EndpointConfig(
data.get("url"),
data.get("params"),
data.get("headers"),
data.get("basic_auth"),
data.get("token"),
data.get("token_name"))
data.pop("url"),
**data)

def __eq__(self, other):
if isinstance(self, type(other)):
Expand Down
23 changes: 23 additions & 0 deletions tests/base/test_utils.py
Expand Up @@ -236,3 +236,26 @@ def test_bool_str():
assert actual["one"] == "yes"
assert actual["two"] == "true"
assert actual["three"] == "True"


def test_default_token_name():
test_data = {
'url': 'http://test',
'token': 'token'
}

actual = EndpointConfig.from_dict(test_data)

assert actual.token_name == 'token'


def test_custom_token_name():
test_data = {
'url': 'http://test',
'token': 'token',
'token_name': 'test_token'
}

actual = EndpointConfig.from_dict(test_data)

assert actual.token_name == 'test_token'

0 comments on commit cd674f8

Please sign in to comment.