Skip to content

Commit f6d3f2b

Browse files
committed
Merge pull request #39 from aoberoi/issue-38
adds tests for archive status unknown and unknown properties, fixes #38
2 parents 9c3121a + 568e622 commit f6d3f2b

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

tests/test_archive.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,3 @@ def test_delete_archive(self):
9393
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
9494
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
9595
# TODO: test that the object is invalidated
96-

tests/test_archive_api.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,53 @@ def test_find_archives_with_offset_and_count(self):
460460
expect(archive_list).to.have.property(u('count')).being.equal(6)
461461
expect(list(archive_list.items)).to.have.length_of(4)
462462
# TODO: we could inspect each item in the list
463+
464+
@httpretty.activate
465+
def test_find_expired_archive(self):
466+
archive_id = u('f6e7ee58-d6cf-4a59-896b-6d56b158ec71')
467+
httpretty.register_uri(httpretty.GET, u('https://api.opentok.com/v2/partner/{0}/archive/{1}').format(self.api_key, archive_id),
468+
body=textwrap.dedent(u("""\
469+
{
470+
"createdAt" : 1395187836000,
471+
"duration" : 62,
472+
"id" : "f6e7ee58-d6cf-4a59-896b-6d56b158ec71",
473+
"name" : "",
474+
"partnerId" : 123456,
475+
"reason" : "",
476+
"sessionId" : "SESSIONID",
477+
"size" : 8347554,
478+
"status" : "expired",
479+
"url" : null
480+
}""")),
481+
status=200,
482+
content_type=u('application/json'))
483+
484+
archive = self.opentok.get_archive(archive_id)
485+
486+
expect(archive).to.be.an(Archive)
487+
expect(archive).to.have.property(u('status')).being.equal(u('expired'))
488+
489+
@httpretty.activate
490+
def test_find_archive_with_unknown_properties(self):
491+
archive_id = u('f6e7ee58-d6cf-4a59-896b-6d56b158ec71')
492+
httpretty.register_uri(httpretty.GET, u('https://api.opentok.com/v2/partner/{0}/archive/{1}').format(self.api_key, archive_id),
493+
body=textwrap.dedent(u("""\
494+
{
495+
"createdAt" : 1395187836000,
496+
"duration" : 62,
497+
"id" : "f6e7ee58-d6cf-4a59-896b-6d56b158ec71",
498+
"name" : "",
499+
"partnerId" : 123456,
500+
"reason" : "",
501+
"sessionId" : "SESSIONID",
502+
"size" : 8347554,
503+
"status" : "expired",
504+
"url" : null,
505+
"notarealproperty" : "not a real value"
506+
}""")),
507+
status=200,
508+
content_type=u('application/json'))
509+
510+
archive = self.opentok.get_archive(archive_id)
511+
512+
expect(archive).to.be.an(Archive)

0 commit comments

Comments
 (0)