Skip to content

Commit

Permalink
Update test_archive.py to expects module
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Mun committed Aug 1, 2016
1 parent e8f056b commit c591843
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/test_archive.py
@@ -1,7 +1,7 @@
import unittest
from six import text_type, u, b, PY2, PY3
from nose.tools import raises
from sure import expect
from expects import *
import httpretty
import textwrap
import json
Expand Down Expand Up @@ -58,25 +58,25 @@ def test_stop_archive(self):
archive.stop()

validate_jwt_header(self, httpretty.last_request().headers[u('x-opentok-auth')])
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
expect(archive).to.be.an(Archive)
expect(archive).to.have.property(u('id')).being.equal(archive_id)
expect(archive).to.have.property(u('name')).being.equal(u(''))
expect(archive).to.have.property(u('status')).being.equal(u('stopped'))
expect(archive).to.have.property(u('session_id')).being.equal(u('SESSIONID'))
expect(archive).to.have.property(u('partner_id')).being.equal(123456)
expect(httpretty.last_request().headers[u('user-agent')]).to(contain(u('OpenTok-Python-SDK/')+__version__))
expect(httpretty.last_request().headers[u('content-type')]).to(equal(u('application/json')))
expect(archive).to(be_an(Archive))
expect(archive).to(have_property(u('id'), archive_id))
expect(archive).to(have_property(u('name'), u('')))
expect(archive).to(have_property(u('status'), u('stopped')))
expect(archive).to(have_property(u('session_id'), u('SESSIONID')))
expect(archive).to(have_property(u('partner_id'), 123456))
if PY2:
created_at = datetime.datetime.fromtimestamp(1395183243, pytz.UTC)
if PY3:
created_at = datetime.datetime.fromtimestamp(1395183243, datetime.timezone.utc)
expect(archive).to.have.property(u('created_at')).being.equal(created_at)
expect(archive).to.have.property(u('size')).being.equal(0)
expect(archive).to.have.property(u('duration')).being.equal(0)
expect(archive).to.have.property(u('has_audio')).being.equal(True)
expect(archive).to.have.property(u('has_video')).being.equal(False)
expect(archive).to.have.property(u('output_mode')).being.equal(OutputModes.composed)
expect(archive).to.have.property(u('url')).being.equal(None)
expect(archive).to(have_property(u('created_at'), created_at))
expect(archive).to(have_property(u('size'), 0))
expect(archive).to(have_property(u('duration'), 0))
expect(archive).to(have_property(u('has_audio'), True))
expect(archive).to(have_property(u('has_video'), False))
expect(archive).to(have_property(u('output_mode'), OutputModes.composed))
expect(archive).to(have_property(u('url'), None))

@httpretty.activate
def test_delete_archive(self):
Expand All @@ -103,6 +103,6 @@ def test_delete_archive(self):
archive.delete()

validate_jwt_header(self, httpretty.last_request().headers[u('x-opentok-auth')])
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
expect(httpretty.last_request().headers[u('user-agent')]).to(contain(u('OpenTok-Python-SDK/')+__version__))
expect(httpretty.last_request().headers[u('content-type')]).to(equal(u('application/json')))
# TODO: test that the object is invalidated

0 comments on commit c591843

Please sign in to comment.