Exemplo n.º 1
0
 def _build_sns_with_token(self, seconds_after_current_time):
     from snsapi.utils import JsonDict
     import time
     token = JsonDict()
     token.expires_in = time.time() + seconds_after_current_time
     sns = SNSBase()
     sns.token = token
     return sns
Exemplo n.º 2
0
 def _build_sns_with_token(self, seconds_after_current_time):
     from snsapi.utils import JsonDict
     import time
     token = JsonDict()
     token.expires_in = time.time() + seconds_after_current_time
     sns = SNSBase()
     sns.token = token
     return sns
Exemplo n.º 3
0
 def test_snsbase_new_channel_full(self):
     nc = SNSBase.new_channel(full=True)
     eq_(4, len(nc), WRONG_RESULT_ERROR)
     in_('channel_name', nc)
     in_('open', nc)
     in_('description', nc)
     in_('methods', nc)
Exemplo n.º 4
0
 def test_snsbase_new_channel_full(self):
     nc = SNSBase.new_channel(full=True)
     print nc
     eq_(4, len(nc), WRONG_RESULT_ERROR)
     ok_(('channel_name' in nc), WRONG_RESULT_ERROR)
     ok_(('open' in nc), WRONG_RESULT_ERROR)
     ok_(('description' in nc), WRONG_RESULT_ERROR)
     ok_(('methods' in nc), WRONG_RESULT_ERROR)
Exemplo n.º 5
0
 def test_snsbase_new_channel_full(self):
     nc = SNSBase.new_channel(full=True)
     eq_(7, len(nc), WRONG_RESULT_ERROR)
     in_('channel_name', nc)
     in_('open', nc)
     in_('description', nc)
     in_('methods', nc)
     in_('user_name', nc)
     in_('user_id', nc)
Exemplo n.º 6
0
 def _expand_url_ok(self, url, expected_url):
     sns = SNSBase()
     ex_url = sns._expand_url(url)
     eq_(ex_url, expected_url)
Exemplo n.º 7
0
 def _parse_code_ok(self, url, code):
     sns = SNSBase()
     token = sns._parse_code(url)
     ok_(isinstance(token, snsapi.utils.JsonDict))
     eq_(token.code, code)
Exemplo n.º 8
0
 def test_snsbase_new_channel_normal(self):
     nc = SNSBase.new_channel()
     eq_(2, len(nc), WRONG_RESULT_ERROR)
     in_('channel_name', nc)
     in_('open', nc)
Exemplo n.º 9
0
 def _expand_url_ok(self, url, expected_url):
     sns = SNSBase()
     ex_url = sns._expand_url(url)
     eq_(ex_url, expected_url)
Exemplo n.º 10
0
 def _parse_code_ok(self, url, code):
     sns = SNSBase()
     token = sns._parse_code(url)
     ok_(isinstance(token, snsapi.utils.JsonDict))
     eq_(token.code, code)
Exemplo n.º 11
0
 def test_snsbase_expire_after_3(self):
     # Token not exist, consider as expired.
     eq_(SNSBase().expire_after(), 0)
Exemplo n.º 12
0
 def test_snsbase_new_channel_normal(self):
     nc = SNSBase.new_channel()
     eq_(2, len(nc), WRONG_RESULT_ERROR)
     in_('channel_name', nc)
     in_('open', nc)