Skip to content

Commit

Permalink
[CADL-41] One more test and changes on project handling due to introd…
Browse files Browse the repository at this point in the history
…uced incompatibility
  • Loading branch information
angelo-romano committed Jan 29, 2025
1 parent df9aa40 commit b39dc8c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions py311/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _project(self, id):
project = Project(
Entity(
self.site.session,
self="%sprojects/%s" % (self.site.self, id),
self="%sprojects/%s/" % (self.site.self, id),
element="shoji:entity",
body={"name": "Target project"},
)
Expand Down Expand Up @@ -373,7 +373,7 @@ def _create_dataset(self, on_311=None, pk=None, **values):
)
project_id = PROJECT_311_ID if on_311 else PROJECT_ID
if project_id:
ds_data["project"] = "/projects/%s" % project_id
ds_data["project"] = "%sprojects/%s/" % (self.site.self, project_id)
ds = self.site.datasets.create(as_entity(ds_data)).refresh()
if pk:
ds.variables.create(
Expand Down Expand Up @@ -704,6 +704,18 @@ def _test_cube_query_on_view(self):
view, view_instance = self._create_view(ds_instance)
return self._assert_cube_query(view)

def _test_run_script_rename_variable(self):
ds, ds_instance = self._create_dataset(name="test_dataset")
body = """RENAME A TO A1;"""
orig_var_id = ds_instance.variables.by("alias")["A"].id
ds_instance = self._run_script(
ds_instance, as_entity({"body": body, "async": False})
)
assert ds_instance.variables.by("alias")["A1"].id == orig_var_id
ds = self._change_dataset_version(ds)
ds_instance = ds_instance.refresh()
assert ds_instance.variables.by("alias")["A1"].id == orig_var_id

def _test_run_script_change_var_name(self):
ds, ds_instance = self._create_dataset(name="test_dataset")
body = """CHANGE TITLE IN cat1 WITH "Var A";"""
Expand Down Expand Up @@ -1255,6 +1267,7 @@ def _test_import_csv_dataset(self):
"test_run_script_create_numeric_array",
"test_run_script_create_categorical_case",
"test_run_script_create_categorical_recode",
"test_run_script_rename_variable",
]


Expand Down

0 comments on commit b39dc8c

Please sign in to comment.