
from nova.tests.functional.api_sample_tests import test_servers


class ServersIpsJsonTest(test_servers.ServersSampleBase):
    sample_dir = 'server-ips'

    def test_get(self):
        # Test getting a server's IP information.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips' % uuid)
        self._verify_response('server-ips-resp', {}, response, 200)

    def test_get_by_network(self):
        # Test getting a server's IP information by network id.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips/private' % uuid)
        self._verify_response('server-ips-network-resp', {}, response, 200)


from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api_sample_tests import test_servers


class ServersIpsJsonTest(test_servers.ServersSampleBase):
    sample_dir = 'server-ips'

    def test_get(self):
        # Test getting a server's IP information.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips' % uuid)
        self._verify_response('server-ips-resp', {}, response, 200)

    def test_get_by_network(self):
        # Test getting a server's IP information by network id.
        server_uuid = self._post_server()
        network_label = nova_fixtures.NeutronFixture.network_1['name']
        response = self._do_get('servers/%s/ips/%s' % (
            server_uuid, network_label))
        self._verify_response('server-ips-network-resp', {}, response, 200)

Make it obvious where we're getting our names from
trivial: Make it obvious where we're getting our names from

Change-Id: Ib9aa790c8999e50a2a3587561604ff1e51666f38
Signed-off-by: Stephen Finucane <492121341a95b3c3aab646bed44634f739dd019b@redhat.com>

  
+ from nova.tests import fixtures as nova_fixtures
  from nova.tests.functional.api_sample_tests import test_servers
  
  
  class ServersIpsJsonTest(test_servers.ServersSampleBase):
      sample_dir = 'server-ips'
  
      def test_get(self):
          # Test getting a server's IP information.
          uuid = self._post_server()
          response = self._do_get('servers/%s/ips' % uuid)
          self._verify_response('server-ips-resp', {}, response, 200)
  
      def test_get_by_network(self):
          # Test getting a server's IP information by network id.
-         uuid = self._post_server()
+         server_uuid = self._post_server()
+         network_label = nova_fixtures.NeutronFixture.network_1['name']
-         response = self._do_get('servers/%s/ips/private' % uuid)
+         response = self._do_get('servers/%s/ips/%s' % (
+             server_uuid, network_label))
          self._verify_response('server-ips-network-resp', {}, response, 200)
  
Make it obvious where we're getting our names from
## Code Before:

from nova.tests.functional.api_sample_tests import test_servers


class ServersIpsJsonTest(test_servers.ServersSampleBase):
    sample_dir = 'server-ips'

    def test_get(self):
        # Test getting a server's IP information.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips' % uuid)
        self._verify_response('server-ips-resp', {}, response, 200)

    def test_get_by_network(self):
        # Test getting a server's IP information by network id.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips/private' % uuid)
        self._verify_response('server-ips-network-resp', {}, response, 200)

## Instruction:
Make it obvious where we're getting our names from
## Code After:

from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api_sample_tests import test_servers


class ServersIpsJsonTest(test_servers.ServersSampleBase):
    sample_dir = 'server-ips'

    def test_get(self):
        # Test getting a server's IP information.
        uuid = self._post_server()
        response = self._do_get('servers/%s/ips' % uuid)
        self._verify_response('server-ips-resp', {}, response, 200)

    def test_get_by_network(self):
        # Test getting a server's IP information by network id.
        server_uuid = self._post_server()
        network_label = nova_fixtures.NeutronFixture.network_1['name']
        response = self._do_get('servers/%s/ips/%s' % (
            server_uuid, network_label))
        self._verify_response('server-ips-network-resp', {}, response, 200)
