blob: ba923869aa2338027e4ceb65d3d992b1d0efd0e7 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "google_apis/calendar/calendar_api_url_generator.h"
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
namespace google_apis {
namespace calendar {
// Make sure the hard-coded urls are returned.
TEST(CalendarApiUrlGeneratorTest, GetColorListUrl) {
CalendarApiUrlGenerator url_generator_;
EXPECT_EQ("https://www.googleapis.com/calendar/v3/colors",
url_generator_.GetCalendarColorListUrl().spec());
}
TEST(CalendarApiUrlGeneratorTest, GetEventListUrl) {
CalendarApiUrlGenerator url_generator_;
base::Time start;
EXPECT_TRUE(base::Time::FromString("13 Jun 2021 10:00 PST", &start));
base::Time end;
EXPECT_TRUE(base::Time::FromString("16 Jun 2021 10:00 PST", &end));
EXPECT_EQ(
"https://www.googleapis.com/calendar/v3/calendars/primary/"
"events?timeMin=2021-06-13T18%3A00%3A00.000Z"
"&timeMax=2021-06-16T18%3A00%3A00.000Z"
"&singleEvents=true",
url_generator_.GetCalendarEventListUrl(start, end, /*single_events=*/true)
.spec());
}
} // namespace calendar
} // namespace google_apis