Merge "Add tests for barbican modules and states"
diff --git a/_modules/runtest/tempest_sections/dashboard.py b/_modules/runtest/tempest_sections/dashboard.py
index 008af2b..b28781e 100644
--- a/_modules/runtest/tempest_sections/dashboard.py
+++ b/_modules/runtest/tempest_sections/dashboard.py
@@ -30,7 +30,15 @@
                 port = self.get_item_when_condition_match('horizon.server.bind.port', horizon_enable)
                 protocol = 'http'
                 ip = self.get_item_when_condition_match('_param.cluster_local_address', horizon_enable)
-            return "{}://{}:{}".format(protocol, ip, port)
+            # When CSRF protection is enabled Refferer and Host header should match.
+            # Common browsers doesn't add default ports like 80 and 443 to the headers
+            # Use the same logic here to make sure test passed when CSRF protection is enabled and
+            # we using default port numbers. More info may be found here:
+            # * https://code.djangoproject.com/ticket/26037
+            # * https://stackoverflow.com/questions/27533011/django-csrf-error-casused-by-nginx-x-forwarded-host
+            if str(port) not in ['80', '443']:
+               return "{}://{}:{}".format(protocol, ip, port)
+            return "{}://{}".format(protocol, ip)
 
     @property
     def login_url(self):
diff --git a/metadata/service/tempest/init.yml b/metadata/service/tempest/init.yml
index 5dd8e41..9613452 100644
--- a/metadata/service/tempest/init.yml
+++ b/metadata/service/tempest/init.yml
@@ -17,6 +17,7 @@
     runtest_heat_plugin_skip_functional_test_list: 'UpdateServerNetworksTest, StackTemplateValidateTest'
     # UpdateServerNetworksTest, StackTemplateValidateTest : These tests support in openstack Queens, but not in Pike.
     runtest_path_to_ca_file: '/etc/ssl/certs/ca-certificates.crt'
+    runtest_path_to_boot_config_env_file: '/usr/local/lib/python2.7/dist-packages/heat_tempest_plugin/tests/scenario/templates/boot_config_none_env.yaml'
     runtest_local_image_url: ${_param:glance_image_cirros_location}
     runtest_local_img_dir: /tmp
     runtest_local_img_file: ${_param:glance_image_cirros_name}.img
@@ -85,6 +86,7 @@
         ca_file: ${_param:runtest_path_to_ca_file}
         image_ref: ${_param:glance_image_fedora_name}
         minimal_image_ref: ${_param:glance_image_cirros_name}
+        boot_config_env: ${_param:runtest_path_to_boot_config_env_file}
       scenario:
         img_file: ${_param:runtest_local_img_file}
         img_dir: ${_param:runtest_local_img_dir}