~jamesh/storage-provider-webdav/delete-item

« back to all changes in this revision

Viewing changes to tests/davprovider/davprovider_test.cpp

  • Committer: James Henstridge
  • Date: 2016-11-10 10:02:32 UTC
  • Revision ID: james@jamesh.id.au-20161110100232-39oeqiy5kjb0ahwh
Add a test for create_folder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
    EXPECT_EQ(ItemType::file, item->type());
310
310
}
311
311
 
 
312
TEST_F(DavProviderTests, create_folder)
 
313
{
 
314
    auto account = get_client();
 
315
 
 
316
    shared_ptr<Root> root;
 
317
    {
 
318
        QFutureWatcher<QVector<shared_ptr<Root>>> watcher;
 
319
        QSignalSpy spy(&watcher, &decltype(watcher)::finished);
 
320
        watcher.setFuture(account->roots());
 
321
        if (spy.count() == 0)
 
322
        {
 
323
            ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME));
 
324
        }
 
325
        auto roots = watcher.result();
 
326
        ASSERT_EQ(1, roots.size());
 
327
        root = roots[0];
 
328
    }
 
329
 
 
330
    shared_ptr<Folder> folder;
 
331
    {
 
332
        QFutureWatcher<shared_ptr<Folder>> watcher;
 
333
        QSignalSpy spy(&watcher, &decltype(watcher)::finished);
 
334
        watcher.setFuture(root->create_folder("folder"));
 
335
        if (spy.count() == 0)
 
336
        {
 
337
            ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME));
 
338
        }
 
339
        folder = watcher.result();
 
340
    }
 
341
}
 
342
 
312
343
TEST_F(DavProviderTests, create_file)
313
344
{
314
345
    int const segments = 50;