Skip to content

Commit

Permalink
Update the monetdb image for the testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
KFilippopolitis committed Jan 11, 2024
1 parent df8d506 commit 891a584
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion mipdb/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def from_db(cls, schema, db):
new_table = cls(schema)
new_table.set_table(
{
code: CommonDataElement.from_metadata(json.loads(metadata)[0])
code: CommonDataElement.from_metadata(json.loads(metadata))
for code, metadata in res.items()
}
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mipdb"
version = "2.4.6"
version = "2.4.7"
description = ""
authors = ["Your Name <[email protected]>"]

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
IP = "127.0.0.1"
PORT = 50123
USERNAME = "admin"
PASSWORD = "admin"
PASSWORD = "executor"
DB_NAME = "db"

DEFAULT_OPTIONS = [
Expand Down Expand Up @@ -65,7 +65,7 @@ def monetdb_container():
container = client.containers.get("mipdb-testing")
except docker.errors.NotFound:
container = client.containers.run(
"madgik/mipenginedb:dev",
"madgik/exareme2_db:latest",
detach=True,
ports={"50000/tcp": PORT},
name="mipdb-testing",
Expand Down
12 changes: 6 additions & 6 deletions tests/mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def get_dataset_status(self, dataset_id):

def get_metadata(self, schema):
return {
"var1": '[{"code": "var1", "sql_type": "text", "description": "", "label": "Variable 1", "methodology": "", "is_categorical": false, "type": "nominal"}]',
"subjectcode": '[{"label": "subjectcode", "code": "subjectcode", "sql_type": "text", "description": "", "methodology": "", "is_categorical": false, "type": "nominal"}]',
"var2": '[{"code": "var2", "sql_type": "text", "description": "", "enumerations": {"1": "Level1", "2.0": "Level2"}, "label": "Variable 2", "methodology": "", "is_categorical": true, "type": "nominal"}]',
"dataset": '[{"code": "dataset", "sql_type": "text", "description": "", "enumerations": {"dataset": "Dataset", "dataset1": "Dataset 1", "dataset2": "Dataset 2"}, "label": "Dataset", "methodology": "", "is_categorical": true, "type": "nominal"}]',
"var3": '[{"code": "var3", "sql_type": "real", "description": "", "label": "Variable 3", "methodology": "", "is_categorical": false, "min": 0, "max": 100, "type": "nominal"}]',
"var4": '[{"code": "var4", "sql_type": "int", "units": "years", "description": "", "label": "Variable 4", "methodology": "", "is_categorical": false, "type": "nominal"}]',
"var1": '{"code": "var1", "sql_type": "text", "description": "", "label": "Variable 1", "methodology": "", "is_categorical": false, "type": "nominal"}',
"subjectcode": '{"label": "subjectcode", "code": "subjectcode", "sql_type": "text", "description": "", "methodology": "", "is_categorical": false, "type": "nominal"}',
"var2": '{"code": "var2", "sql_type": "text", "description": "", "enumerations": {"1": "Level1", "2.0": "Level2"}, "label": "Variable 2", "methodology": "", "is_categorical": true, "type": "nominal"}',
"dataset": '{"code": "dataset", "sql_type": "text", "description": "", "enumerations": {"dataset": "Dataset", "dataset1": "Dataset 1", "dataset2": "Dataset 2"}, "label": "Dataset", "methodology": "", "is_categorical": true, "type": "nominal"}',
"var3": '{"code": "var3", "sql_type": "real", "description": "", "label": "Variable 3", "methodology": "", "is_categorical": false, "min": 0, "max": 100, "type": "nominal"}',
"var4": '{"code": "var4", "sql_type": "int", "units": "years", "description": "", "label": "Variable 4", "methodology": "", "is_categorical": false, "type": "nominal"}',
}

def get_data_model_status(self, data_model_id):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def test_tag_dataset(db):
(properties, *_), *_ = db.execute(
f"select properties from mipdb_metadata.datasets"
).fetchall()
assert '{"tags": ["tag"], "properties": {}}' == properties
assert '{"tags":["tag"],"properties":{}}' == properties
action_record = db.execute(f"select * from mipdb_metadata.actions").fetchall()
action_id, action = action_record[3]
assert action_id == 4
Expand Down Expand Up @@ -752,7 +752,7 @@ def test_untag_dataset(db):
(properties, *_), *_ = db.execute(
f"select properties from mipdb_metadata.datasets"
).fetchall()
assert '{"tags": [], "properties": {}}' == properties
assert '{"tags":[],"properties":{}}' == properties
action_record = db.execute(f"select * from mipdb_metadata.actions").fetchall()
action_id, action = action_record[3]
assert action_id == 4
Expand Down Expand Up @@ -801,7 +801,7 @@ def test_property_dataset_addition(db):
(properties, *_), *_ = db.execute(
f"select properties from mipdb_metadata.datasets"
).fetchall()
assert '{"tags": [], "properties": {"key": "value"}}' == properties
assert '{"tags":[],"properties":{"key":"value"}}' == properties
action_record = db.execute(f"select * from mipdb_metadata.actions").fetchall()
action_id, action = action_record[3]
assert action_id == 4
Expand Down Expand Up @@ -868,7 +868,7 @@ def test_property_dataset_deletion(db):
(properties, *_), *_ = db.execute(
f"select properties from mipdb_metadata.datasets"
).fetchall()
assert '{"tags": [], "properties": {}}' == properties
assert '{"tags":[],"properties":{}}' == properties
action_record = db.execute(f"select * from mipdb_metadata.actions").fetchall()
action_id, action = action_record[3]
assert action_id == 4
Expand Down
12 changes: 6 additions & 6 deletions tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ def test_insert_values_with_db(self, db, data_model_metadata):
)
result = [(name, json.loads(val)) for name, val in res.fetchall()]
assert result == [
("var1", [False]),
("subjectcode", [False]),
("var2", [True]),
("dataset", [True]),
("var3", [False]),
("var4", [False]),
("var1", False),
("subjectcode", False),
("var2", True),
("dataset", True),
("var3", False),
("var4", False),
]

def test_get_values_from_cdes_full_schema_data(self, data_model_metadata):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_usecases.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def test_tag_dataset_with_db(db, data_model_metadata):
)

properties = db.get_dataset_properties(1)
assert properties == '{"tags": ["tag"], "properties": {}}'
assert properties == '{"tags":["tag"],"properties":{}}'


@pytest.mark.database
Expand Down Expand Up @@ -993,7 +993,7 @@ def test_untag_dataset_with_db(db, data_model_metadata):
)

properties = db.get_dataset_properties(1)
assert properties == '{"tags": ["tag2", "tag3"], "properties": {}}'
assert properties == '{"tags":["tag2","tag3"],"properties":{}}'


@pytest.mark.database
Expand All @@ -1015,7 +1015,7 @@ def test_add_property2dataset_with_db(db, data_model_metadata):
)

properties = db.get_dataset_properties(1)
assert properties == '{"tags": [], "properties": {"key": "value"}}'
assert properties == '{"tags":[],"properties":{"key":"value"}}'


@pytest.mark.database
Expand Down Expand Up @@ -1060,7 +1060,7 @@ def test_remove_property_from_dataset_with_db(db, data_model_metadata):
)
properties = db.get_dataset_properties(1)
assert (
properties == '{"tags": [], "properties": {"key": "value", "key1": "value1"}}'
properties == '{"tags":[],"properties":{"key":"value","key1":"value1"}}'
)


Expand Down

0 comments on commit 891a584

Please sign in to comment.