1
1
import unittest
2
2
from six import text_type , u , b , PY2 , PY3
3
3
from nose .tools import raises
4
- from sure import expect
4
+ from expects import *
5
5
import httpretty
6
6
import textwrap
7
7
import json
@@ -58,25 +58,25 @@ def test_stop_archive(self):
58
58
archive .stop ()
59
59
60
60
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 ) )
69
69
if PY2 :
70
70
created_at = datetime .datetime .fromtimestamp (1395183243 , pytz .UTC )
71
71
if PY3 :
72
72
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 ) )
80
80
81
81
@httpretty .activate
82
82
def test_delete_archive (self ):
@@ -103,6 +103,6 @@ def test_delete_archive(self):
103
103
archive .delete ()
104
104
105
105
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' ) ))
108
108
# TODO: test that the object is invalidated
0 commit comments