From 356de10b42809205c851ba8bd124103737219cf1 Mon Sep 17 00:00:00 2001 From: shubhra Date: Tue, 4 Jun 2024 23:02:43 +0530 Subject: [PATCH 1/4] testing enum generation --- tests/test_cli/test_enum.py | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_cli/test_enum.py diff --git a/tests/test_cli/test_enum.py b/tests/test_cli/test_enum.py new file mode 100644 index 0000000000..50dfd25856 --- /dev/null +++ b/tests/test_cli/test_enum.py @@ -0,0 +1,51 @@ +import unittest +from composio.client.enums import Tag, App, Action, Trigger + + +class TestTagEnum(unittest.TestCase): + def test_tag_enum_values(self): + # Test for specific expected enum values + self.assertEqual(Tag.IMPORTANT.value, ("default", "important")) + + def test_tag_enum_name_property(self): + # Test the name property + self.assertEqual(Tag.IMPORTANT.name, "default") + + +class TestAppEnum(unittest.TestCase): + def test_app_enum_values(self): + # Test for specific expected enum values + self.assertTrue(App.GITHUB.value, "github") + + def test_app_enum_is_local_property(self): + # Test the is_local property + self.assertFalse(App.GITHUB.is_local) + self.assertTrue(App.LOCALWORKSPACE.is_local) + + +class TestActionEnum(unittest.TestCase): + def test_action_enum_values(self): + # Test for specific expected enum values + self.assertEqual(Action.GITHUB_ACTIONS_GET_SELF_HOSTED_RUNNER_FOR_ORG.value, + ("github", "github_actions_get_self_hosted_runner_for_org", False)) + + def test_action_enum_properties(self): + # Test properties + self.assertEqual(Action.GITHUB_ISSUES_LIST.app, "github") + self.assertEqual(Action.GITHUB_ISSUES_LIST.action, "github_issues_list") + self.assertFalse(Action.GITHUB_ISSUES_LIST.no_auth) + + +class TestTriggerEnum(unittest.TestCase): + def test_trigger_enum_values(self): + # Test for specific expected enum values + self.assertEqual(Trigger.SLACK_NEW_MESSAGE.value, ("slack", "slack_receive_message")) + + def test_trigger_enum_properties(self): + # Test properties + self.assertEqual(Trigger.SLACK_THREAD_REPLY.app, "slack") + self.assertEqual(Trigger.SLACK_THREAD_REPLY.event, "slack_receive_thread_reply") + + +if __name__ == '__main__': + unittest.main() From 866693c65e5a4147e637b87da9674dcfb83a48ed Mon Sep 17 00:00:00 2001 From: shubhra Date: Tue, 4 Jun 2024 23:07:31 +0530 Subject: [PATCH 2/4] testing enum generation --- tests/test_cli/test_enum.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_cli/test_enum.py b/tests/test_cli/test_enum.py index 50dfd25856..edc5c4bfc4 100644 --- a/tests/test_cli/test_enum.py +++ b/tests/test_cli/test_enum.py @@ -6,11 +6,31 @@ class TestTagEnum(unittest.TestCase): def test_tag_enum_values(self): # Test for specific expected enum values self.assertEqual(Tag.IMPORTANT.value, ("default", "important")) + self.assertEqual(Tag.IMPORTANT.value, ("default", "important")) + self.assertEqual(Tag.ASANA_GOAL_RELATIONSHIPS.value, ("asana", "Goal relationships")) + self.assertEqual(Tag.ATTIO_LISTS.value, ("attio", "Lists")) + self.assertEqual(Tag.BREVO_TASKS.value, ("brevo", "Tasks")) + self.assertEqual(Tag.CLICKUP_TASKS.value, ("clickup", "Tasks")) def test_tag_enum_name_property(self): # Test the name property self.assertEqual(Tag.IMPORTANT.name, "default") + def test_tag_enum_names(self): + """Test the names of the Tag enum.""" + self.assertEqual(Tag.IMPORTANT.name, "default") + self.assertEqual(Tag.ASANA_GOAL_RELATIONSHIPS.name, "asana") + self.assertEqual(Tag.ATTIO_LISTS.name, "attio") + self.assertEqual(Tag.BREVO_TASKS.name, "brevo") + self.assertEqual(Tag.CLICKUP_TASKS.name, "clickup") + + def test_tag_enum_contains(self): + """Test if specific tags are in the enum.""" + self.assertTrue(Tag.IMPORTANT in Tag) + self.assertTrue(Tag.ASANA_BATCH_API in Tag) + self.assertTrue(Tag.BREVO_EMAIL_CAMPAIGNS in Tag) + self.assertTrue(Tag.CLICKUP_USERS in Tag) + class TestAppEnum(unittest.TestCase): def test_app_enum_values(self): @@ -47,5 +67,6 @@ def test_trigger_enum_properties(self): self.assertEqual(Trigger.SLACK_THREAD_REPLY.event, "slack_receive_thread_reply") + if __name__ == '__main__': unittest.main() From 125ba40f92efaf1d6d487e910cbf434fb523cfe7 Mon Sep 17 00:00:00 2001 From: shubhra Date: Tue, 4 Jun 2024 23:08:20 +0530 Subject: [PATCH 3/4] fix --- tests/test_cli/test_enum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cli/test_enum.py b/tests/test_cli/test_enum.py index edc5c4bfc4..4cdca64683 100644 --- a/tests/test_cli/test_enum.py +++ b/tests/test_cli/test_enum.py @@ -35,7 +35,7 @@ def test_tag_enum_contains(self): class TestAppEnum(unittest.TestCase): def test_app_enum_values(self): # Test for specific expected enum values - self.assertTrue(App.GITHUB.value, "github") + self.assertEqual(App.GITHUB.value, "github") def test_app_enum_is_local_property(self): # Test the is_local property From 497f48db7ef6435f1eaf94e3773ec9be7725bf8b Mon Sep 17 00:00:00 2001 From: shubhra Date: Wed, 5 Jun 2024 14:06:06 +0530 Subject: [PATCH 4/4] remove dup --- composio/local_tools/local_workspace/workspace/tool.py | 1 + tests/test_cli/test_enum.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/composio/local_tools/local_workspace/workspace/tool.py b/composio/local_tools/local_workspace/workspace/tool.py index 7ea3718318..c8d07499f4 100644 --- a/composio/local_tools/local_workspace/workspace/tool.py +++ b/composio/local_tools/local_workspace/workspace/tool.py @@ -10,6 +10,7 @@ CreateWorkspaceAction, ) + class LocalWorkspace(Tool): """ Use this action to create a workspace and get workspace ID in return. diff --git a/tests/test_cli/test_enum.py b/tests/test_cli/test_enum.py index 4cdca64683..0f8cb9a249 100644 --- a/tests/test_cli/test_enum.py +++ b/tests/test_cli/test_enum.py @@ -6,7 +6,6 @@ class TestTagEnum(unittest.TestCase): def test_tag_enum_values(self): # Test for specific expected enum values self.assertEqual(Tag.IMPORTANT.value, ("default", "important")) - self.assertEqual(Tag.IMPORTANT.value, ("default", "important")) self.assertEqual(Tag.ASANA_GOAL_RELATIONSHIPS.value, ("asana", "Goal relationships")) self.assertEqual(Tag.ATTIO_LISTS.value, ("attio", "Lists")) self.assertEqual(Tag.BREVO_TASKS.value, ("brevo", "Tasks"))