2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
23 #include "gtest/gtest.h"
25 using ::testing::Test;
26 using ::testing::WithParamInterface;
27 using ::testing::ValuesIn;
29 struct TestURLGetWithoutUserDetailsData
36 std::ostream& operator<<(std::ostream& os,
37 const TestURLGetWithoutUserDetailsData& rhs)
39 return os << "(Input: " << rhs.input <<
40 "; Redact: " << (rhs.redact?"true":"false") <<
41 "; Expected: " << rhs.expected << ")";
44 class TestURLGetWithoutUserDetails : public Test,
45 public WithParamInterface<TestURLGetWithoutUserDetailsData>
49 TEST_P(TestURLGetWithoutUserDetails, GetWithoutUserDetails)
51 CURL input(GetParam().input);
52 std::string result = input.GetWithoutUserDetails(GetParam().redact);
53 EXPECT_EQ(result, GetParam().expected);
56 const TestURLGetWithoutUserDetailsData values[] = {
57 { std::string("smb://example.com/example"), std::string("smb://example.com/example"), false },
58 { std::string("smb://example.com/example"), std::string("smb://example.com/example"), true },
59 { std::string("smb://god:universe@example.com/example"), std::string("smb://example.com/example"), false },
60 { std::string("smb://god@example.com/example"), std::string("smb://USERNAME@example.com/example"), true },
61 { std::string("smb://god:universe@example.com/example"), std::string("smb://USERNAME:PASSWORD@example.com/example"), true },
62 { std::string("http://god:universe@example.com:8448/example|auth=digest"), std::string("http://USERNAME:PASSWORD@example.com:8448/example|auth=digest"), true }
65 INSTANTIATE_TEST_CASE_P(URL, TestURLGetWithoutUserDetails, ValuesIn(values));