Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Israel Garcia
libcloudstorage
Commits
f6621e73
Commit
f6621e73
authored
Feb 14, 2018
by
Paweł Wegner
Browse files
test: updated to recent libcloudstorage changes.
parent
d6d6597d
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/CloudProvider/CloudProviderTest.cpp
View file @
f6621e73
...
...
@@ -156,7 +156,7 @@ class CloudProviderTest : public ::testing::Test {
static
void
lookup
(
ICloudProvider
*
p
,
IItem
::
Pointer
directory
,
const
std
::
string
&
name
,
IItem
::
Pointer
&
result
)
{
auto
lst
=
p
->
listDirectoryAsync
(
directory
)
->
result
().
right
();
auto
lst
=
p
->
listDirectory
Simple
Async
(
directory
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
for
(
auto
i
:
*
lst
)
if
(
i
->
filename
()
==
name
)
{
...
...
@@ -180,11 +180,11 @@ class CloudProviderTest : public ::testing::Test {
ASSERT_NE
(
item
,
nullptr
);
item
=
p
->
renameItemAsync
(
item
,
"3"
)
->
result
().
right
();
ASSERT_NE
(
item
,
nullptr
);
auto
lst
=
p
->
listDirectoryAsync
(
root
)
->
result
().
right
();
auto
lst
=
p
->
listDirectory
Simple
Async
(
root
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0"
,
"3"
}));
ASSERT_NE
(
p
->
renameItemAsync
(
item
,
"1"
)
->
result
().
right
(),
nullptr
);
lst
=
p
->
listDirectoryAsync
(
root
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
root
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0"
,
"1"
}));
}
...
...
@@ -197,11 +197,11 @@ class CloudProviderTest : public ::testing::Test {
item
=
p
->
renameItemAsync
(
item
,
"1.txt"
)
->
result
().
right
();
ASSERT_NE
(
item
,
nullptr
);
auto
directory
=
lookup
(
p
,
root
,
"0"
);
auto
lst
=
p
->
listDirectoryAsync
(
directory
)
->
result
().
right
();
auto
lst
=
p
->
listDirectory
Simple
Async
(
directory
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"1.txt"
}));
ASSERT_NE
(
p
->
renameItemAsync
(
item
,
"0.txt"
)
->
result
().
right
(),
nullptr
);
lst
=
p
->
listDirectoryAsync
(
directory
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
directory
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0.txt"
}));
}
...
...
@@ -215,17 +215,17 @@ class CloudProviderTest : public ::testing::Test {
ASSERT_NE
(
destination
,
nullptr
);
auto
moved
=
p
->
moveItemAsync
(
source
,
destination
)
->
result
().
right
();
ASSERT_NE
(
moved
,
nullptr
);
auto
lst
=
p
->
listDirectoryAsync
(
root
)
->
result
().
right
();
auto
lst
=
p
->
listDirectory
Simple
Async
(
root
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"1"
}));
lst
=
p
->
listDirectoryAsync
(
destination
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
destination
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0"
,
"1.txt"
}));
lst
=
p
->
listDirectoryAsync
(
moved
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
moved
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0.txt"
}));
ASSERT_NE
(
p
->
moveItemAsync
(
moved
,
root
)
->
result
().
right
(),
nullptr
);
lst
=
p
->
listDirectoryAsync
(
root
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
root
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0"
,
"1"
}));
}
...
...
@@ -239,15 +239,15 @@ class CloudProviderTest : public ::testing::Test {
ASSERT_NE
(
destination
,
nullptr
);
auto
moved
=
p
->
moveItemAsync
(
source
,
destination
)
->
result
().
right
();
ASSERT_NE
(
moved
,
nullptr
);
auto
lst
=
p
->
listDirectoryAsync
(
destination
)
->
result
().
right
();
auto
lst
=
p
->
listDirectory
Simple
Async
(
destination
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0.txt"
,
"1.txt"
}));
lst
=
p
->
listDirectoryAsync
(
source_parent
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
source_parent
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_TRUE
(
filename
(
*
lst
).
empty
());
ASSERT_NE
(
p
->
moveItemAsync
(
moved
,
source_parent
)
->
result
().
right
(),
nullptr
);
lst
=
p
->
listDirectoryAsync
(
source_parent
)
->
result
().
right
();
lst
=
p
->
listDirectory
Simple
Async
(
source_parent
)
->
result
().
right
();
ASSERT_NE
(
lst
,
nullptr
);
ASSERT_EQ
(
filename
(
*
lst
),
std
::
vector
<
std
::
string
>
({
"0.txt"
}));
}
...
...
test/CloudProvider/GoogleDriveTest.cpp
View file @
f6621e73
...
...
@@ -110,7 +110,8 @@ TEST_F(GoogleDriveTest, ListDirectoryTest) {
EXPECT_CALL
(
http
,
create
(
"https://www.googleapis.com/drive/v3/files"
,
"GET"
,
true
))
.
WillRepeatedly
(
Return
(
request
));
auto
r
=
provider
->
listDirectoryAsync
(
provider
->
rootDirectory
())
->
result
();
auto
r
=
provider
->
listDirectorySimpleAsync
(
provider
->
rootDirectory
())
->
result
();
ASSERT_NE
(
r
.
right
(),
nullptr
);
ASSERT_EQ
(
r
.
right
()
->
size
(),
2
);
ASSERT_EQ
(
r
.
right
()
->
front
()
->
filename
(),
"test"
);
...
...
@@ -147,7 +148,8 @@ TEST_F(GoogleDriveTest, AuthorizationTest) {
.
WillOnce
(
Return
(
next_token_request
));
EXPECT_CALL
(
http_factory
,
create
(
_
,
_
,
IHttpServer
::
Type
::
Authorization
))
.
WillRepeatedly
(
CreateServer
());
auto
r
=
provider
->
listDirectoryAsync
(
provider
->
rootDirectory
())
->
result
();
auto
r
=
provider
->
listDirectorySimpleAsync
(
provider
->
rootDirectory
())
->
result
();
if
(
r
.
left
())
util
::
log
(
r
.
left
()
->
code_
,
r
.
left
()
->
description_
);
ASSERT_NE
(
r
.
right
(),
nullptr
);
ASSERT_EQ
(
r
.
right
()
->
size
(),
2
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment