summaryrefslogtreecommitdiff
path: root/tests/administration_validation_tests.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-20 19:38:37 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-20 19:38:37 +0200
commit9a16fd2cf0bca13d8a3015da89833db2230b391f (patch)
treec530e73e50fe41a2ca52d058a657f3a01f1265ef /tests/administration_validation_tests.cpp
parent214852f61cd3b9fda257044e9d822b94b4be7e5d (diff)
ui refactor
Diffstat (limited to 'tests/administration_validation_tests.cpp')
-rw-r--r--tests/administration_validation_tests.cpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/tests/administration_validation_tests.cpp b/tests/administration_validation_tests.cpp
index 4b88e37..f307d2d 100644
--- a/tests/administration_validation_tests.cpp
+++ b/tests/administration_validation_tests.cpp
@@ -208,16 +208,23 @@ TEST _administration_validate_costcenter_isvalid(void)
// Contact
//////////////////
-TEST _administration_validate_contact_add(void)
+contact _create_test_contact()
{
- administration_create_empty("");
contact p1 = administration_contact_create_empty();
strops_copy(p1.name, "John Johnsson", sizeof(p1.name));
strops_copy(p1.address.address1, "Address 1", sizeof(p1.address.address1));
strops_copy(p1.address.country_code, "FR", sizeof(p1.address.country_code));
strops_copy(p1.address.city, "Paris", sizeof(p1.address.city));
strops_copy(p1.address.postal, "12345", sizeof(p1.address.postal));
+ strops_copy(p1.email, "test@test.com", sizeof(p1.email));
p1.type = contact_type::CONTACT_CONSUMER;
+ return p1;
+}
+
+TEST _administration_validate_contact_add(void)
+{
+ administration_create_empty("");
+ contact p1 = _create_test_contact();
ASSERT_EQ(administration_contact_add(p1), A_ERR_SUCCESS);
@@ -243,13 +250,7 @@ TEST _administration_validate_contact_import(void)
{
administration_create_empty("");
- contact p1 = administration_contact_create_empty();
- strops_copy(p1.name, "John Johnsson", sizeof(p1.name));
- strops_copy(p1.address.address1, "Address 1", sizeof(p1.address.address1));
- strops_copy(p1.address.country_code, "FR", sizeof(p1.address.country_code));
- strops_copy(p1.address.city, "Paris", sizeof(p1.address.city));
- strops_copy(p1.address.postal, "12345", sizeof(p1.address.postal));
- p1.type = contact_type::CONTACT_CONSUMER;
+ contact p1 = _create_test_contact();
ASSERT_EQ(administration_contact_import(p1), A_ERR_SUCCESS);
@@ -275,13 +276,7 @@ TEST _administration_validate_contact_import(void)
TEST _administration_validate_contact_update(void)
{
administration_create_empty("");
- contact p1 = administration_contact_create_empty();
- strops_copy(p1.name, "John Johnsson", sizeof(p1.name));
- strops_copy(p1.address.address1, "Address 1", sizeof(p1.address.address1));
- strops_copy(p1.address.country_code, "FR", sizeof(p1.address.country_code));
- strops_copy(p1.address.city, "Paris", sizeof(p1.address.city));
- strops_copy(p1.address.postal, "12345", sizeof(p1.address.postal));
- p1.type = contact_type::CONTACT_CONSUMER;
+ contact p1 = _create_test_contact();
ASSERT_EQ(administration_contact_add(p1), A_ERR_SUCCESS);
ASSERT_EQ(administration_contact_update(p1), A_ERR_SUCCESS);
@@ -316,13 +311,7 @@ TEST _administration_validate_contact_update(void)
TEST _administration_validate_contact_remove(void)
{
administration_create_empty("");
- contact p1 = administration_contact_create_empty();
- strops_copy(p1.name, "John Johnsson", sizeof(p1.name));
- strops_copy(p1.address.address1, "Address 1", sizeof(p1.address.address1));
- strops_copy(p1.address.country_code, "FR", sizeof(p1.address.country_code));
- strops_copy(p1.address.city, "Paris", sizeof(p1.address.city));
- strops_copy(p1.address.postal, "12345", sizeof(p1.address.postal));
- p1.type = contact_type::CONTACT_CONSUMER;
+ contact p1 = _create_test_contact();
ASSERT_EQ(administration_contact_add(p1), A_ERR_SUCCESS);
@@ -338,13 +327,7 @@ TEST _administration_validate_contact_remove(void)
TEST _administration_validate_contact_isvalid(void)
{
administration_create_empty("");
- contact p1 = administration_contact_create_empty();
- strops_copy(p1.name, "John Johnsson", sizeof(p1.name));
- strops_copy(p1.address.address1, "Address 1", sizeof(p1.address.address1));
- strops_copy(p1.address.country_code, "FR", sizeof(p1.address.country_code));
- strops_copy(p1.address.city, "Paris", sizeof(p1.address.city));
- strops_copy(p1.address.postal, "12345", sizeof(p1.address.postal));
- p1.type = contact_type::CONTACT_CONSUMER;
+ contact p1 = _create_test_contact();
ASSERT_EQ(administration_contact_is_valid(p1), A_ERR_SUCCESS);
ASSERT_EQ(administration_contact_is_valid(p1), A_ERR_SUCCESS);