def test_vhost_verify_is_in(mock_exists, *args): """Tests htaccess verify method.""" htaccess = Htaccess(DEFAULT_ATTS) htaccess.data = HTACCESS_DATA htaccess.sections = [TEST_SECTION] mock_exists.return_value = True assert htaccess.verify()
def test_vhost_verify_without_section(mock_exists, *args): """Tests htaccess verify method.""" htaccess = Htaccess(DEFAULT_ATTS) htaccess.data = HTACCESS_DATA_NO_SECTION htaccess.sections = [TEST_SECTION] mock_exists.return_value = True assert not htaccess.verify() assert htaccess.verify(True) # Correct it.
def test_vhost_verify_with_altered_section(mock_exists, *args): """Tests htaccess verify method.""" htaccess = Htaccess(DEFAULT_ATTS) htaccess.data = HTACCESS_DATA_CHANGED htaccess.sections = [TEST_SECTION] mock_exists.return_value = True assert htaccess.verify() with patch(_INPUT, return_value='n'): assert htaccess.verify(True) assert htaccess.data == HTACCESS_DATA_CHANGED with patch(_INPUT, return_value='y'): assert htaccess.verify(True) assert htaccess.data != HTACCESS_DATA_CHANGED assert htaccess.sections[0].is_in(htaccess.data)
def test_htaccess_init(): """Tests htaccess init method.""" htaccess = Htaccess(DEFAULT_ATTS) htaccess.data = HTACCESS_DATA assert htaccess.path == '/the/htaccess/path'