Beispiel #1
0
 public function testGroupLibraryReading()
 {
     $groupID = self::$config['ownedPublicNoAnonymousGroupID'];
     API::groupClear($groupID);
     $json = API::groupCreateItem($groupID, 'book', ['title' => "Test"], $this);
     try {
         API::useAPIKey(self::$config['apiKey']);
         $response = API::groupGet($groupID, "items");
         $this->assert200($response);
         $this->assertNumResults(1, $response);
         // An anonymous request should fail, because libraryReading is members
         API::useAPIKey(false);
         $response = API::groupGet($groupID, "items");
         $this->assert403($response);
     } finally {
         API::groupClear($groupID);
     }
 }
Beispiel #2
0
	public function testLibraryGroup() {
		$json = API::groupCreateItem(self::$config['ownedPrivateGroupID'], 'book', [], $this, 'json');
		$this->assertEquals('group', $json['library']['type']);
		$this->assertEquals(self::$config['ownedPrivateGroupID'], $json['library']['id']);
		$this->assertEquals(self::$config['ownedPrivateGroupName'], $json['library']['name']);
		$this->assertRegExp('%^https?://[^/]+/groups/[0-9]+$%', $json['library']['links']['alternate']['href']);
		$this->assertEquals('text/html', $json['library']['links']['alternate']['type']);
	}