|
3 | 3 | import unittest |
4 | 4 |
|
5 | 5 | from runpod.api.mutations.container_register_auth import ( |
| 6 | + delete_container_registry_auth, |
6 | 7 | generate_container_registry_auth, |
| 8 | + update_container_registry_auth |
7 | 9 | ) |
8 | 10 |
|
9 | 11 |
|
@@ -33,3 +35,47 @@ def test_generate_container_registry_auth(self): |
33 | 35 | ) |
34 | 36 | self.assertIn("id", actual_mutation) |
35 | 37 | self.assertIn("name", actual_mutation) |
| 38 | + |
| 39 | + def test_update_container_registry_auth(self): |
| 40 | + """ |
| 41 | + Test that the update_container_registry_auth function produces the correct |
| 42 | + GraphQL mutation string with the provided registry_auth_id, username and password. |
| 43 | + """ |
| 44 | + # Define test inputs |
| 45 | + registry_auth_id = "testAuthId" |
| 46 | + username = "testUser" |
| 47 | + password = "testPass" |
| 48 | + |
| 49 | + # Generate the actual mutation string |
| 50 | + actual_mutation = update_container_registry_auth( |
| 51 | + registry_auth_id, username, password |
| 52 | + ).strip() |
| 53 | + |
| 54 | + # Verify key components of the mutation string |
| 55 | + self.assertIn("mutation UpdateRegistryAuth", actual_mutation) |
| 56 | + self.assertIn( |
| 57 | + 'updateRegistryAuth(input: {id: "testAuthId", username: "testUser", password: "testPass"})', # pylint: disable=line-too-long |
| 58 | + actual_mutation, |
| 59 | + ) |
| 60 | + self.assertIn("id", actual_mutation) |
| 61 | + self.assertIn("name", actual_mutation) |
| 62 | + |
| 63 | + def test_delete_container_registry_auth(self): |
| 64 | + """ |
| 65 | + Test that the delete_container_registry_auth function produces the correct |
| 66 | + GraphQL mutation string with the provided registry_auth_id |
| 67 | + """ |
| 68 | + # Define test inputs |
| 69 | + registry_auth_id = "testAuthId" |
| 70 | + |
| 71 | + # Generate the actual mutation string |
| 72 | + actual_mutation = delete_container_registry_auth( |
| 73 | + registry_auth_id |
| 74 | + ).strip() |
| 75 | + |
| 76 | + # Verify key components of the mutation string |
| 77 | + self.assertIn("mutation DeleteRegistryAuth", actual_mutation) |
| 78 | + self.assertIn( |
| 79 | + 'deleteRegistryAuth(registryAuthId: "testAuthId")', # pylint: disable=line-too-long |
| 80 | + actual_mutation, |
| 81 | + ) |
0 commit comments