Skip to content

Commit 31e2f0b

Browse files
committed
[ADD] tests for phone validation activate/deactivate methods
1 parent 4e1871c commit 31e2f0b

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

spp_base_common/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## 2025-11-20
4+
5+
### 2025-11-20 14:30:00 - [ADD] tests for phone validation activate/deactivate methods
6+
7+
- Added test_06_activate_phone_validation to verify state changes from inactive to active
8+
- Added test_07_deactivate_phone_validation to verify state changes from active to inactive
9+
- Completes test coverage for phone validation state management methods

spp_base_common/tests/test_phone_number_validation.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,33 @@ def test_05_create_phone_with_invalid_special_characters(self):
101101
self.phone_model.create(phone_vals)
102102

103103
self.assertIn("Phone number contains invalid special characters", str(cm.exception))
104+
105+
def test_06_activate_phone_validation(self):
106+
"""Test activating a phone validation record"""
107+
phone_validation = self.phone_validation_model.create(
108+
{
109+
"number_of_digits": 9,
110+
"with_prefix": False,
111+
"state": "inactive",
112+
}
113+
)
114+
self.assertEqual(phone_validation.state, "inactive")
115+
116+
phone_validation.activate_phone_validation()
117+
self.assertEqual(phone_validation.state, "active", "Phone validation state should be 'active' after activation")
118+
119+
def test_07_deactivate_phone_validation(self):
120+
"""Test deactivating a phone validation record"""
121+
phone_validation = self.phone_validation_model.create(
122+
{
123+
"number_of_digits": 8,
124+
"with_prefix": False,
125+
"state": "active",
126+
}
127+
)
128+
self.assertEqual(phone_validation.state, "active")
129+
130+
phone_validation.deactivate_phone_validation()
131+
self.assertEqual(
132+
phone_validation.state, "inactive", "Phone validation state should be 'inactive' after deactivation"
133+
)

0 commit comments

Comments
 (0)