test: update DNS configuration correctly 91/263291/1 accepted/tizen/6.5/unified/20211028.094338 accepted/tizen/unified/20210906.123717 submit/tizen/20210901.031812 submit/tizen_6.5/20211028.161701 tizen_6.5.m2_release
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 31 Aug 2021 02:14:52 +0000 (11:14 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 31 Aug 2021 02:14:56 +0000 (11:14 +0900)
DNS was dynamic although IP configuration was static.

Change-Id: I6a26cf070f4072fbce178d9a13d1a3fa1230c27c

test/connection_test.c

index 9c86789..83e6ad3 100755 (executable)
@@ -610,6 +610,7 @@ static int test_update_ip_info(connection_profile_h profile, connection_address_
        int rv = 0;
        int input_int = 0;
        char input_str[100] = {0,};
+       int dns_input = 0;
 
        if (test_get_user_string("Input IP Address - (Enter for skip) :", input_str, 100)) {
                rv = connection_profile_set_ip_address(profile,
@@ -643,8 +644,30 @@ static int test_update_ip_info(connection_profile_h profile, connection_address_
                        return -1;
        }
 
-       if (test_update_dns_info(profile, address_family) < 0)
-               return -1;
+       if (test_get_user_int("Input DNS Address Type (Static:1, DHCP:2)"
+                               " - (Enter for skip) :", &dns_input)) {
+               switch (dns_input) {
+               case CONNECTION_DNS_CONFIG_TYPE_STATIC:
+                       rv = connection_profile_set_dns_config_type(
+                                       profile,
+                                       address_family,
+                                       CONNECTION_DNS_CONFIG_TYPE_STATIC);
+                       if (rv != CONNECTION_ERROR_NONE)
+                               return -1;
+                       if (test_update_dns_info(profile,
+                                               address_family) == -1)
+                               return -1;
+                       break;
+               case CONNECTION_DNS_CONFIG_TYPE_DYNAMIC:
+                       rv = connection_profile_set_dns_config_type(
+                                       profile,
+                                       address_family,
+                                       CONNECTION_DNS_CONFIG_TYPE_DYNAMIC);
+                       if (rv != CONNECTION_ERROR_NONE)
+                               return -1;
+                       break;
+               }
+       }
 
        return 1;
 }