"""Tests for various classes in pip._internal.models
"""

from pip._vendor.packaging.version import parse as parse_version

from pip._internal.models import candidate, index


class TestPackageIndex(object):
    """Tests for pip._internal.models.index.PackageIndex
    """

    def test_gives_right_urls(self):
        url = "https://mypypi.internal/path/"
        pack_index = index.PackageIndex(url)

        assert pack_index.netloc == "mypypi.internal"
        assert pack_index.url == url
        assert pack_index.simple_url == url + "simple"
        assert pack_index.pypi_url == url + "pypi"

    def test_PyPI_urls_are_correct(self):
        pack_index = index.PyPI

        assert pack_index.netloc == "pypi.org"
        assert pack_index.url == "https://pypi.org/"
        assert pack_index.simple_url == "https://pypi.org/simple"
        assert pack_index.pypi_url == "https://pypi.org/pypi"


class TestInstallationCandidate(object):

    def test_sets_correct_variables(self):
        obj = candidate.InstallationCandidate(
            "A", "1.0.0", "https://somewhere.com/path/A-1.0.0.tar.gz"
        )
        assert obj.project == "A"
        assert obj.version == parse_version("1.0.0")
        assert obj.location == "https://somewhere.com/path/A-1.0.0.tar.gz"

    # NOTE: This isn't checking the ordering logic; only the data provided to
    #       it is correct.
    def test_sets_the_right_key(self):
        obj = candidate.InstallationCandidate(
            "A", "1.0.0", "https://somewhere.com/path/A-1.0.0.tar.gz"
        )
        assert obj._compare_key == (obj.project, obj.version, obj.location)

@@ -350,16 +350,70 @@
 /path/%22%0A
+        file_storage_domain = %22files.mypypi.internal%22%0A
         
@@ -447,16 +447,37 @@
 ndex(url
+, file_storage_domain
 )%0A%0A     
@@ -501,72 +501,142 @@
 dex.
-netloc == %22mypypi.internal%22%0A        assert pack_index.url == url
+url == url%0A        assert pack_index.file_storage_domain == file_storage_domain%0A%0A        assert pack_index.netloc == %22mypypi.internal%22
 %0A   
@@ -1042,16 +1042,501 @@
 g/pypi%22%0A
+        assert pack_index.file_storage_domain == %22files.pythonhosted.org%22%0A%0A    def test_TestPyPI_urls_are_correct(self):%0A        pack_index = index.TestPyPI%0A%0A        assert pack_index.netloc == %22test.pypi.org%22%0A        assert pack_index.url == %22https://test.pypi.org/%22%0A        assert pack_index.simple_url == %22https://test.pypi.org/simple%22%0A        assert pack_index.pypi_url == %22https://test.pypi.org/pypi%22%0A        assert pack_index.file_storage_domain == %22test-files.pythonhosted.org%22%0A
 %0A%0Aclass 

Update PackageIndex tests for the addition of TestPyPI