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
35
36
|
#include "test.h"
#include "mongo.h"
void
test_mongo_sync_gridfs_stream_find (void)
{
mongo_sync_connection *conn;
mongo_sync_gridfs *gfs;
bson *query;
query = bson_build (BSON_TYPE_STRING, "filename", "bogus-fn", -1,
BSON_TYPE_NONE);
bson_finish (query);
ok (mongo_sync_gridfs_stream_find (NULL, query) == NULL,
"mongo_sync_gridfs_stream_find() should fail with a NULL connection");
begin_network_tests (2);
conn = mongo_sync_connect (config.primary_host, config.primary_port, FALSE);
gfs = mongo_sync_gridfs_new (conn, config.gfs_prefix);
ok (mongo_sync_gridfs_stream_find (gfs, NULL) == NULL,
"mongo_sync_gridfs_stream_find() fails with a NULL query");
ok (mongo_sync_gridfs_stream_find (gfs, query) == NULL,
"mongo_sync_gridfs_stream_find() fails if the file is not found");
mongo_sync_gridfs_free (gfs, TRUE);
end_network_tests ();
bson_free (query);
}
RUN_TEST (3, mongo_sync_gridfs_stream_find);
|