"""Tests for the config command
"""

from pip.status_codes import ERROR
from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin


def test_no_options_passed_should_error(script):
    result = script.pip('config', expect_error=True)
    assert result.returncode == ERROR


class TestBasicLoading(ConfigurationFileIOMixin):

    def test_reads_user_file(self, script):
        contents = """
            [test]
            hello = 1
        """

        with self.patched_file(kinds.USER, contents):
            result = script.pip("config", "--list")

        assert "test.hello = 1" in result.stdout

@@ -30,16 +30,47 @@
 nd%0A%22%22%22%0A%0A
+import pytest%0Aimport textwrap%0A%0A
 from pip
@@ -375,32 +375,108 @@
     
-def test_reads_user_file
+@pytest.mark.skip(%22Can't modify underlying file for any mode%22)%0A    def test_reads_file_appropriately
 (sel
@@ -665,10 +665,8 @@
 %22, %22
---
 list
@@ -699,27 +699,953 @@
 ello
- = 1%22 in
+=1%22 in result.stdout%0A%0A    def test_modification_pipeline(self, script):%0A        script.pip(%0A            %22config%22, %22get%22, %22test.blah%22, expect_error=True%0A        )%0A        script.pip(%22config%22, %22set%22, %22test.blah%22, %221%22)%0A%0A        result4 = script.pip(%22config%22, %22get%22, %22test.blah%22)%0A        assert
  result
+4
 .stdout
+.strip() == %221%22%0A%0A    def test_listing_is_correct(self, script):%0A        script.pip(%22config%22, %22set%22, %22test.listing-beta%22, %222%22)%0A        script.pip(%22config%22, %22set%22, %22test.listing-alpha%22, %221%22)%0A        script.pip(%22config%22, %22set%22, %22test.listing-gamma%22, %223%22)%0A%0A        result = script.pip(%22config%22, %22list%22)%0A%0A        lines = list(filter(%0A            lambda x: x.startswith(%22test.listing-%22),%0A            result.stdout.splitlines()%0A        ))%0A%0A        expected = %22%22%22%0A            test.listing-alpha='1'%0A            test.listing-beta='2'%0A            test.listing-gamma='3'%0A        %22%22%22%0A%0A        assert lines == textwrap.dedent(expected).strip().splitlines()
 %0A

Add basic tests for configuration