Skip to content

Commit ed85869

Browse files
authored
Merge pull request #91 from davemun/update-test-lib
Update test lib from 'sure' to 'expects'
2 parents 8116ca2 + c591843 commit ed85869

File tree

6 files changed

+211
-211
lines changed

6 files changed

+211
-211
lines changed

opentok/opentok.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def _create_jwt_auth_header(self):
453453
'iss': self.api_key,
454454
'iat': int(time.time()), # current time in unix time (seconds)
455455
'exp': int(time.time()) + (60*3), # 3 minutes in the future (seconds)
456-
'jti': '{:f}'.format(random.random())
456+
'jti': '{0}'.format(0, random.random())
457457
}
458458

459459
return jwt.encode(payload, self.api_secret, algorithm='HS256')

test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
nose
22
httpretty
3-
sure
3+
expects
44
wheel

tests/test_archive.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from six import text_type, u, b, PY2, PY3
33
from nose.tools import raises
4-
from sure import expect
4+
from expects import *
55
import httpretty
66
import textwrap
77
import json
@@ -58,25 +58,25 @@ def test_stop_archive(self):
5858
archive.stop()
5959

6060
validate_jwt_header(self, httpretty.last_request().headers[u('x-opentok-auth')])
61-
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
62-
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
63-
expect(archive).to.be.an(Archive)
64-
expect(archive).to.have.property(u('id')).being.equal(archive_id)
65-
expect(archive).to.have.property(u('name')).being.equal(u(''))
66-
expect(archive).to.have.property(u('status')).being.equal(u('stopped'))
67-
expect(archive).to.have.property(u('session_id')).being.equal(u('SESSIONID'))
68-
expect(archive).to.have.property(u('partner_id')).being.equal(123456)
61+
expect(httpretty.last_request().headers[u('user-agent')]).to(contain(u('OpenTok-Python-SDK/')+__version__))
62+
expect(httpretty.last_request().headers[u('content-type')]).to(equal(u('application/json')))
63+
expect(archive).to(be_an(Archive))
64+
expect(archive).to(have_property(u('id'), archive_id))
65+
expect(archive).to(have_property(u('name'), u('')))
66+
expect(archive).to(have_property(u('status'), u('stopped')))
67+
expect(archive).to(have_property(u('session_id'), u('SESSIONID')))
68+
expect(archive).to(have_property(u('partner_id'), 123456))
6969
if PY2:
7070
created_at = datetime.datetime.fromtimestamp(1395183243, pytz.UTC)
7171
if PY3:
7272
created_at = datetime.datetime.fromtimestamp(1395183243, datetime.timezone.utc)
73-
expect(archive).to.have.property(u('created_at')).being.equal(created_at)
74-
expect(archive).to.have.property(u('size')).being.equal(0)
75-
expect(archive).to.have.property(u('duration')).being.equal(0)
76-
expect(archive).to.have.property(u('has_audio')).being.equal(True)
77-
expect(archive).to.have.property(u('has_video')).being.equal(False)
78-
expect(archive).to.have.property(u('output_mode')).being.equal(OutputModes.composed)
79-
expect(archive).to.have.property(u('url')).being.equal(None)
73+
expect(archive).to(have_property(u('created_at'), created_at))
74+
expect(archive).to(have_property(u('size'), 0))
75+
expect(archive).to(have_property(u('duration'), 0))
76+
expect(archive).to(have_property(u('has_audio'), True))
77+
expect(archive).to(have_property(u('has_video'), False))
78+
expect(archive).to(have_property(u('output_mode'), OutputModes.composed))
79+
expect(archive).to(have_property(u('url'), None))
8080

8181
@httpretty.activate
8282
def test_delete_archive(self):
@@ -103,6 +103,6 @@ def test_delete_archive(self):
103103
archive.delete()
104104

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

0 commit comments

Comments
 (0)