-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathAVACLTest.cpp
More file actions
31 lines (24 loc) · 855 Bytes
/
AVACLTest.cpp
File metadata and controls
31 lines (24 loc) · 855 Bytes
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
#define BOOST_TEST_MODULE AVObject 1.0 Test
#include <string>
#include <vector>
#include <boost/test/unit_test.hpp>
#include "AVOSCloud.h"
#include "ACL/AVACL.h"
#include "AVObject/AVObject.h"
using namespace std;
using namespace avoscloud;
#error replace ${appId} and ${appKey} with real appId and appKey
BOOST_AUTO_TEST_CASE(AVACL_SetReadAndWriteAccess_Test) {
AVOSCloud::setApplicationId("${appId}", "${appKey}");
AVObject* object = AVObject::objectWithClassName("Post");
object->setObjectForKey("cyang", "name");
object->setObjectForKey(27, "age");
AVACL* acl = AVACL::ACL();
acl->setReadAccessForUserId(true, "1234567890fedfe234");
acl->setWriteAccessForUserId(true, "34567fedfedfab345");
object->setACL(acl);
object->saveInBackground();
BOOST_CHECK(object->objectId.length() > 0);
object->release();
acl->release();
}