Removes duplicate code autoscale_complete

Function autoscale_complete will be required by many test
cases, hence moving it to common.

Change-Id: Ie0545ad35c6704bc86b26748ae99f9c66ca5a468
diff --git a/common/test.py b/common/test.py
index 42fa43c..976ae8b 100644
--- a/common/test.py
+++ b/common/test.py
@@ -595,3 +595,11 @@
                 if len(matched) == num_expected:
                     return matched
             time.sleep(build_interval)
+
+    def check_autoscale_complete(self, stack_id, expected_num):
+        res_list = self.client.resources.list(stack_id)
+        all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
+                                                       'CREATE_COMPLETE')
+                               for res in res_list)
+        all_res = len(res_list) == expected_num
+        return all_res and all_res_complete
diff --git a/scenario/test_autoscaling_lb.py b/scenario/test_autoscaling_lb.py
index f5b292e..833e9a8 100644
--- a/scenario/test_autoscaling_lb.py
+++ b/scenario/test_autoscaling_lb.py
@@ -48,14 +48,6 @@
                 resp.add(r.text)
         self.assertEqual(expected_num, len(resp))
 
-    def autoscale_complete(self, stack_id, expected_num):
-        res_list = self.client.resources.list(stack_id)
-        all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
-                                                       'CREATE_COMPLETE')
-                               for res in res_list)
-        all_res = len(res_list) == expected_num
-        return all_res and all_res_complete
-
     def test_autoscaling_loadbalancer_neutron(self):
         """Check work of AutoScaing and Neutron LBaaS v1 resource in Heat.
 
@@ -111,7 +103,7 @@
         asg = self.client.resources.get(sid, 'asg')
         test.call_until_true(self.conf.build_timeout,
                              self.conf.build_interval,
-                             self.autoscale_complete,
+                             self.check_autoscale_complete,
                              asg.physical_resource_id, 2)
 
         # Check number of distinctive responses, must now be 2
diff --git a/scenario/test_autoscaling_lbv2.py b/scenario/test_autoscaling_lbv2.py
index 89c4877..b3a1842 100644
--- a/scenario/test_autoscaling_lbv2.py
+++ b/scenario/test_autoscaling_lbv2.py
@@ -48,14 +48,6 @@
                 resp.add(r.text)
         self.assertEqual(expected_num, len(resp))
 
-    def autoscale_complete(self, stack_id, expected_num):
-        res_list = self.client.resources.list(stack_id)
-        all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
-                                                       'CREATE_COMPLETE')
-                               for res in res_list)
-        all_res = len(res_list) == expected_num
-        return all_res and all_res_complete
-
     def test_autoscaling_loadbalancer_neutron(self):
         """Check work of AutoScaing and Neutron LBaaS v2 resource in Heat.
 
@@ -109,7 +101,7 @@
         asg = self.client.resources.get(sid, 'asg')
         test.call_until_true(self.conf.build_timeout,
                              self.conf.build_interval,
-                             self.autoscale_complete,
+                             self.check_autoscale_complete,
                              asg.physical_resource_id, 2)
 
         # Check number of distinctive responses, must now be 2