summaryrefslogtreecommitdiff
path: root/tests/unit/mongo/sync-gridfs/sync_gridfs_list.c
blob: e5857ea7cc205ca36d728865dd733955ea09014d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "test.h"
#include "mongo.h"

void
test_mongo_sync_gridfs_list (void)
{
  mongo_sync_gridfs *gfs;
  bson *query;

  query = bson_build (BSON_TYPE_STRING, "bogus-key", "bogus-value", -1,
                      BSON_TYPE_NONE);
  bson_finish (query);

  ok (mongo_sync_gridfs_list (NULL, NULL) == NULL,
      "mongo_sync_gridfs_list() fails with a NULL GridFS");

  begin_network_tests (1);

  gfs = mongo_sync_gridfs_new
    (mongo_sync_connect (config.primary_host, config.primary_port, FALSE),
     config.gfs_prefix);

  ok (mongo_sync_gridfs_list (gfs, query) == NULL,
      "mongo_sync_gridfs_list() fails with a query that does not match "
      "anything");

  mongo_sync_gridfs_free (gfs, TRUE);

  end_network_tests ();

  bson_free (query);
}

RUN_TEST (2, mongo_sync_gridfs_list);