Skip to content

Commit

Permalink
fix: choose better names for setlabel methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yazdipour committed Jun 18, 2024
1 parent a9a5cec commit 508fe32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions omnivoreql/omnivoreql.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def delete_label(self, label_id: str):
variable_values={"id": label_id},
)

def set_page_labels_by_create_label_inputs(
def set_page_labels(
self, page_id: str, labels: List[CreateLabelInput]
) -> dict:
"""
Expand All @@ -231,9 +231,9 @@ def set_page_labels_by_create_label_inputs(
:param page_id: The ID of the page to set labels for.
:param labels: The labels to set.
"""
return self.set_page_labels_by_labels(page_id, parsed_labels)
return self.set_page_labels_by_fields(page_id, labels)

def set_page_labels_by_labels(self, page_id: str, labels: List[dict]) -> dict:
def set_page_labels_by_fields(self, page_id: str, labels: List[dict]) -> dict:
"""
Set labels for a page.
Expand Down Expand Up @@ -262,7 +262,7 @@ def set_page_labels_by_labels(self, page_id: str, labels: List[dict]) -> dict:
},
)

def set_page_labels_by_label_ids(self, page_id: str, label_ids: List[str]) -> dict:
def set_page_labels_by_ids(self, page_id: str, label_ids: List[str]) -> dict:
"""
Set labels for a page.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_omnivoreql.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_delete_label(self):
label_sample["id"],
)

def test_set_page_labels_by_labels(self):
def test_set_page_labels(self):
# Given
page = self.client.get_articles(limit=1)["search"]["edges"][0]["node"]
label_sample = self.sample_label
Expand All @@ -196,20 +196,20 @@ def test_set_page_labels_by_labels(self):
label_sample["description"],
)
# When
result = self.client.set_page_labels_by_labels(page["id"], [created_label_input])
result = self.client.set_page_labels(page["id"], [created_label_input])
# Then
self.assertIsNotNone(result)
self.assertNotIn("errorCodes", result["setLabels"])
self.assertEqual(
result["setLabels"]["labels"][0]["id"], label_sample["id"]
)

def test_set_page_labels_by_label_ids(self):
def test_set_page_labels_by_ids(self):
# Given
page = self.client.get_articles(limit=1)["search"]["edges"][0]["node"]
label_sample = self.sample_label
# When
result = self.client.set_page_labels_by_label_ids(
result = self.client.set_page_labels_by_ids(
page["id"], label_ids=[label_sample["id"]]
)
# Then
Expand Down

0 comments on commit 508fe32

Please sign in to comment.