mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 09:54:17 +02:00
add option to limit uploads to a single key
This commit is contained in:
parent
5b2896dc09
commit
96a9803e30
4 changed files with 68 additions and 12 deletions
|
|
@ -81,7 +81,8 @@ class UploadProviderTest extends TestCase {
|
|||
$this->demoStore,
|
||||
$this->userProvider,
|
||||
$this->demoProvider,
|
||||
$this->demoSaver
|
||||
$this->demoSaver,
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -306,4 +307,46 @@ class UploadProviderTest extends TestCase {
|
|||
$this->assertEquals(0, $demo->getBlueScore());
|
||||
$this->assertEquals(3, $demo->getRedScore());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Not an HL2 demo
|
||||
*/
|
||||
public function testUploadKey() {
|
||||
$uploadProvider = new UploadProvider(
|
||||
$this->getDatabaseConnection(),
|
||||
'http://example.com',
|
||||
$this->headerParser,
|
||||
$this->parser,
|
||||
$this->demoStore,
|
||||
$this->userProvider,
|
||||
$this->demoProvider,
|
||||
$this->demoSaver,
|
||||
'foo'
|
||||
);
|
||||
|
||||
$steamId = $this->getSteamId('123', 'a');
|
||||
$token = $this->userProvider->store($steamId);
|
||||
|
||||
$this->assertEquals(
|
||||
'Invalid key',
|
||||
$uploadProvider->upload($token, 'RED', 'BLU', 'asdasd', 'asdas')
|
||||
);
|
||||
|
||||
$uploadProvider = new UploadProvider(
|
||||
$this->getDatabaseConnection(),
|
||||
'http://example.com',
|
||||
$this->headerParser,
|
||||
$this->parser,
|
||||
$this->demoStore,
|
||||
$this->userProvider,
|
||||
$this->demoProvider,
|
||||
$this->demoSaver,
|
||||
$token
|
||||
);
|
||||
|
||||
file_put_contents($this->tmpDir . '/foo.dem', 'asd');
|
||||
|
||||
$uploadProvider->upload($token, 'RED', 'BLU', 'asdasd', $this->tmpDir . '/foo.dem');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue