Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
fix: update artifact with auth headers (#690)
Browse files Browse the repository at this point in the history
* chore: fixed bug while updating artifact

* refactor: remove unused logger

* refactor: remove imports

* fix: close webserver

* fix: suppress ssl verification warning

* fix: remove unused imports

* test: add update test

* style: format files

Co-authored-by: Brian-Frederik Jahnke <brian-frederik.jahnke@isst.fraunhofer.de>
Co-authored-by: Brian-Frederik Jahnke <74709618+brianjahnke@users.noreply.github.com>
  • Loading branch information
3 people committed Oct 27, 2021
1 parent 054d01d commit bb4fa0f
Show file tree
Hide file tree
Showing 31 changed files with 100 additions and 91 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

# Changelog
All notable changes to this project will be documented in this file.

## [X.X.X] - XXXX-XX-XX
## [6.5.0] - 2021-10-27

### Added
- New `application.properties` setting `configuration.force.reload` that forces reloading the configuration from the `config.json` instead of using the latest active configuration from the database. If not set, the default value is `false`.
Expand All @@ -13,6 +14,8 @@ All notable changes to this project will be documented in this file.
### Fixed
- Only create agreements from contract offers with valid start and end date.
- Check if agreement has expired before returning data.
- Fix `TransientObjectException` while updating an artifact.
- Add default constructor to `ApiKey` class, to avoid `InstantiationException`.

## [6.4.0] - 2021-10-21

Expand Down
4 changes: 2 additions & 2 deletions charts/dataspace-connector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.6
version: 0.2.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "6.4.0"
appVersion: "6.5.0"

dependencies:
- name: postgresql
Expand Down
36 changes: 18 additions & 18 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ info:
license:
name: "Apache License, Version 2.0"
url: https://www.apache.org/licenses/LICENSE-2.0.txt
version: 6.5.0-SNAPSHOT
version: 6.5.0
servers:
- url: https://localhost:8080
description: Generated server url
Expand Down Expand Up @@ -6899,6 +6899,9 @@ components:
- $ref: '#/components/schemas/AbstractConstraint'
- type: object
properties:
ids:unit:
type: string
format: uri
ids:pipEndpoint:
type: string
format: uri
Expand All @@ -6924,9 +6927,6 @@ components:
- https://w3id.org/idsa/code/STATE
- https://w3id.org/idsa/code/SYSTEM
- https://w3id.org/idsa/code/USER
ids:unit:
type: string
format: uri
ids:operator:
type: string
enum:
Expand Down Expand Up @@ -7006,15 +7006,15 @@ components:
- $ref: '#/components/schemas/AbstractConstraint'
- type: object
properties:
ids:or:
ids:and:
type: array
items:
$ref: '#/components/schemas/Constraint'
ids:and:
ids:xone:
type: array
items:
$ref: '#/components/schemas/Constraint'
ids:xone:
ids:or:
type: array
items:
$ref: '#/components/schemas/Constraint'
Expand Down Expand Up @@ -7085,11 +7085,16 @@ components:
ids:target:
type: string
format: uri
ids:constraint:
ids:assignee:
type: array
items:
oneOf:
- $ref: '#/components/schemas/LogicalConstraint'
type: string
format: uri
ids:assigner:
type: array
items:
type: string
format: uri
ids:action:
type: array
items:
Expand All @@ -7111,20 +7116,15 @@ components:
- https://w3id.org/idsa/code/TRACK_PROVENANCE
- https://w3id.org/idsa/code/USE
- https://w3id.org/idsa/code/WRITE
ids:assignee:
ids:constraint:
type: array
items:
type: string
format: uri
oneOf:
- $ref: '#/components/schemas/LogicalConstraint'
ids:assetRefinement:
oneOf:
- $ref: '#/components/schemas/Constraint'
- $ref: '#/components/schemas/LogicalConstraint'
ids:assigner:
type: array
items:
type: string
format: uri
ids:description:
type: array
items:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<properties>
<!-- General -->
<revision>6.5.0-SNAPSHOT</revision>
<revision>6.5.0</revision>
<email>info@dataspace-connector.de</email>

<!-- Build info -->
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/e2e/active-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
./scripts/tests/contract_negotation_security_level_access.py
./scripts/tests/multiple_artifacts.py
./scripts/tests/single_artifact_multiple_policies.py
./scripts/tests/remote_data_can_be_updated.py
./scripts/tests/subscription_creation.py
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_allow_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from resourceapi import ResourceApi
from idsapi import IdsApi
import requests
import pprint
import sys

Expand All @@ -41,9 +40,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_count_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_log_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_notify_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_prohibit_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/contract_negotation_security_level_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import pprint
import requests
import sys

from idsapi import IdsApi
Expand All @@ -42,9 +41,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
3 changes: 3 additions & 0 deletions scripts/tests/idsapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import requests
import json

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()


class IdsApi:
session = None
Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/multiple_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from resourceapi import ResourceApi
from idsapi import IdsApi
import requests
import pprint
import sys

Expand All @@ -41,9 +40,6 @@ def main(argv):

print("Starting script")

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()

# Provider
provider = ResourceApi(providerUrl)

Expand Down
46 changes: 46 additions & 0 deletions scripts/tests/remote_data_can_be_updated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
#
# Copyright 2020 Fraunhofer Institute for Software and Systems Engineering
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from resourceapi import ResourceApi

connector = ResourceApi("http://localhost:8080")
artifact = connector.create_artifact(
data={
"title": "string",
"description": "string",
"accessUrl": "https://string",
"basicAuth": {"key": "string", "value": "string"},
"apiKey": {"key": "string", "value": "string"},
"value": "string",
"automatedDownload": True,
}
)

success = connector.update_artifact(
artifact=artifact,
data={
"title": "string",
"description": "string",
"accessUrl": "https://string",
"basicAuth": {"key": "string", "value": "string"},
"apiKey": {"key": "string", "value": "string"},
"value": "string",
"automatedDownload": True,
},
)

exit(not success) # Exit success == 0 but True == 1
2 changes: 0 additions & 2 deletions scripts/tests/remote_data_is_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import requests
import pprint
import json
from requests.models import InvalidURL
import tqdm

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()
Expand Down
7 changes: 7 additions & 0 deletions scripts/tests/resourceapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import requests
import json

# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()


class ResourceApi:
session = None
Expand Down Expand Up @@ -45,6 +48,10 @@ def create_artifact(self, data={"value": "SOME LONG VALUE"}):
response = self.session.post(self.recipient + "/api/artifacts", json=data)
return response.headers["Location"]

def update_artifact(self, artifact, data) -> bool:
response = self.session.put(artifact, json=data)
return response.status_code == 204

def create_contract(
self,
data={
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/single_artifact_multiple_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from idsapi import IdsApi
import requests
import pprint
import json
import sys


Expand Down

0 comments on commit bb4fa0f

Please sign in to comment.