Commit 9fe715e4 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test] Refactor tests to use new Asset declaration property

parent 7abcabfa
......@@ -25,7 +25,6 @@
import os
import pytest
import simplejson as json
from PyQt5 import QtCore
......@@ -159,9 +158,9 @@ class TestAssetWidget:
description_key = "description"
if asset_type == AssetType.DATAFORMAT:
description_key = "#" + description_key
with open(asset.declaration_path, "rt") as json_file:
json_data = json.loads(json_file.read())
assert json_data[description_key] == description
json_data = asset.declaration
assert json_data[description_key] == description
def test_new(self, qtbot, monkeypatch, test_prefix, beat_context, asset_type):
if asset_type.can_create():
......
......@@ -25,7 +25,6 @@
import copy
import pytest
import simplejson as json
from PyQt5 import QtCore
......@@ -68,8 +67,7 @@ def reference_view_json(request):
@pytest.fixture()
def reference_database_json(test_prefix):
asset = Asset(test_prefix, AssetType.DATABASE, "simple/2")
with open(asset.declaration_path, "rt") as json_file:
return json.load(json_file)
return asset.declaration
@pytest.fixture()
......@@ -321,11 +319,9 @@ class TestDatabaseEditor:
def test_load_and_dump(self, qtbot, beat_context, test_prefix, test_database):
asset = Asset(test_prefix, AssetType.DATABASE, test_database)
json_data = asset.declaration
editor = DatabaseEditor()
editor.set_context(beat_context)
editor.load_json(json_data)
with open(asset.declaration_path, "rt") as json_file:
json_data = json.load(json_file)
editor = DatabaseEditor()
editor.set_context(beat_context)
editor.load_json(json_data)
assert editor.dump_json() == json_data
assert editor.dump_json() == json_data
......@@ -25,7 +25,6 @@
import pytest
import numpy as np
import simplejson as json
from PyQt5 import QtCore
......@@ -58,8 +57,7 @@ UNSIGNED_TYPES = [InputType.UINT8, InputType.UINT16, InputType.UINT32, InputType
def get_algorithm_declaration(prefix_path, algorithm_name):
asset = Asset(prefix_path, AssetType.ALGORITHM, algorithm_name)
with open(asset.declaration_path, "rt") as json_file:
return json.load(json_file)
return asset.declaration
def get_parameters(prefix_path, algorithm_name):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment