Skip to content

Commit

Permalink
Merge pull request #119 from stonaz/master
Browse files Browse the repository at this point in the history
Interoperability: API key for OpenLabor external layer
  • Loading branch information
nemesifier committed Feb 25, 2014
2 parents a55d9bd + f37b228 commit 58d8b73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions nodeshot/interoperability/synchronizers/OpenLabor.py
Expand Up @@ -43,7 +43,8 @@ class OpenLabor(BaseSynchronizer):
REQUIRED_CONFIG_KEYS = [
'open311_url',
'service_code_get',
'service_code_post'
'service_code_post',
'api_key'
]

def __init__(self, *args, **kwargs):
Expand All @@ -66,6 +67,8 @@ def _init_config(self):

# url for POST
self.post_url = '%srequests.json' % self.open311_url
# api_key
self.api_key = self.config['api_key']

def to_nodeshot(self, node):
"""
Expand Down Expand Up @@ -151,7 +154,7 @@ def to_external(self, node):
"first_name": user_first_name,
"last_name": user_last_name,
"description": node.description,
"api_key": "temporarily_not_used",
"api_key": self.config['api_key'],
"locale": "it_IT",
"position": node.name,
"professionalProfile": node.data.get('professional_profile'),
Expand Down
5 changes: 3 additions & 2 deletions nodeshot/interoperability/tests.py
Expand Up @@ -834,14 +834,15 @@ def test_openlabor_add_node(self):
external.config = json.dumps({
"open311_url": url,
"service_code_get": "001",
"service_code_post": "002"
"service_code_post": "002",
"api_key": "DEVO1395445966"
})
external.full_clean()
external.save()

node = Node()
node.name = 'offerta di lavoro di test'
node.description = 'offerta di lavoro inserita automaticamente tramite unit test'
node.description = 'altra offerta di lavoro inserita automaticamente tramite unit test'
node.geometry = 'POINT (12.5823391919000012 41.8721429276999820)'
node.layer = layer
node.user_id = 1
Expand Down

0 comments on commit 58d8b73

Please sign in to comment.