def detail_volume(self, volume_base_url, volume_id): # Detail the volume specific_volume_url = urljoin(volume_base_url, "%s/" % volume_id) volume_get_resp = self.api_client.get(specific_volume_url) # Validate the output self.assertEqual(volume_get_resp.status_code, status.HTTP_200_OK) verify_expected_output(self, volume_get_resp.data, self.expected_output)
def detail_step_os(self, instance_id): # Detail the instance os_instance_url = urljoin(os_base_instance_url, "%s/" % instance_id) instance_get_resp = self.api_client.get(os_instance_url) # Validate the output self.assertEqual(instance_get_resp.status_code, status.HTTP_200_OK) verify_expected_output(self, instance_get_resp.data, self.expected_output)
def detail_volume(self, volume_base_url, volume_id): #Detail the volume specific_volume_url = urljoin(volume_base_url, '%s/' % volume_id) volume_get_resp = self.api_client.get(specific_volume_url) #Validate the output self.assertEqual(volume_get_resp.status_code, status.HTTP_200_OK) verify_expected_output(self, volume_get_resp.data, self.expected_output)
def test_oauth_token(self): """ Explicitly call auth and test that tokens can be created. """ self.oauth_api_client = OAuthTokenAPIClient() self.oauth_api_client.login(oauth_user='******') verify_expected_output(self, self.oauth_api_client.token, self.expected_output) self.oauth_api_client.logout()
def detail_step_os(self, instance_id): #Detail the instance os_instance_url = urljoin(os_base_instance_url, '%s/' % instance_id) instance_get_resp = self.api_client.get(os_instance_url) #Validate the output self.assertEqual(instance_get_resp.status_code, status.HTTP_200_OK) verify_expected_output(self, instance_get_resp.data, self.expected_output)
def test_api_token(self): """ Explicitly call auth and test that tokens can be created. """ self.api_client = TokenAPIClient() self.api_client.login(username=settings.TEST_RUNNER_USER, password=settings.TEST_RUNNER_PASS) verify_expected_output(self, self.api_client.token, self.expected_output) self.api_client.logout()
def test_api_token(self): """ Explicitly call auth and test that tokens can be created. """ self.api_client = TokenAPIClient() self.api_client.login( username=settings.TEST_RUNNER_USER, password=settings.TEST_RUNNER_PASS) verify_expected_output(self, self.api_client.token, self.expected_output) self.api_client.logout()
def create_volume(self, volume_base_url, post_data): # Create the volume volume_launch_resp = self.api_client.post(volume_base_url, post_data, format="json") # Validate the output if volume_launch_resp.status_code != status.HTTP_201_CREATED: logger.info(volume_launch_resp) self.assertEqual(volume_launch_resp.status_code, status.HTTP_201_CREATED) self.assertIsNotNone(volume_launch_resp.data) verify_expected_output(self, volume_launch_resp.data, self.expected_output) volume_id = volume_launch_resp.data["alias"] return volume_id
def test_openstack_machine(self): """ Testing machines must be done in order * Create the machine * Detail the machine * Delete the machine """ list_machine_resp = self.api_client.get(self.os_machine_url) self.assertEqual(list_machine_resp.status_code, status.HTTP_200_OK) if not list_machine_resp.data: return for machine in list_machine_resp.data: verify_expected_output(self, machine, self.expected_output)
def create_volume(self, volume_base_url, post_data): #Create the volume volume_launch_resp = self.api_client.post(volume_base_url, post_data, format='json') #Validate the output if volume_launch_resp.status_code != status.HTTP_201_CREATED: logger.info(volume_launch_resp) self.assertEqual(volume_launch_resp.status_code, status.HTTP_201_CREATED) self.assertIsNotNone(volume_launch_resp.data) verify_expected_output(self, volume_launch_resp.data, self.expected_output) volume_id = volume_launch_resp.data['alias'] return volume_id
def test_euca_machine(self): """ Testing machines must be done in order * Create the machine * Detail the machine * Delete the machine # Wait for machine to deploy and # Ensure: SSH, VNC, Shellinabox, Deploy access """ list_machine_resp = self.api_client.get(self.euca_machine_url) self.assertEqual(list_machine_resp.status_code, status.HTTP_200_OK) if not list_machine_resp.data: return for machine in list_machine_resp.data: verify_expected_output(self, machine, self.expected_output)
def test_token_output(self): """ Explicitly call auth and test that tokens can be created. """ verify_expected_output(self, self.api_client.token, self.expected_output)