当前位置: 首页>>代码示例>>Python>>正文


Python SmugMug.reset_auth方法代码示例

本文整理汇总了Python中smugpy.SmugMug.reset_auth方法的典型用法代码示例。如果您正苦于以下问题:Python SmugMug.reset_auth方法的具体用法?Python SmugMug.reset_auth怎么用?Python SmugMug.reset_auth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在smugpy.SmugMug的用法示例。


在下文中一共展示了SmugMug.reset_auth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestOauth

# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import reset_auth [as 别名]
class TestOauth(unittest.TestCase):
    def setUp(self):
        self.smugmug = SmugMug(api_key=API_KEY, api_version='1.3.0', app_name='TestApp', oauth_secret=OAUTH_SECRET)

    def test_get_request_token(self):
        self.smugmug.auth_getRequestToken()
        self.assertNotEqual(self.smugmug.oauth_token, None)
        self.assertNotEqual(self.smugmug.oauth_token_secret, None)
        self.smugmug.reset_auth()

    def test_get_access_token(self):
        self.smugmug.auth_getAccessToken()
        self.assertNotEqual(self.smugmug.oauth_token, None)
        self.assertNotEqual(self.smugmug.oauth_token_secret, None)
        self.smugmug.reset_auth()

    def test_request_signature(self):
        url = 'http://api.smugmug.com/services/api/json/'
        parameters = dict(
            method = 'smugmug.albums.get',
            NickName = 'williams'
        )
        timestamp = 1341423551
        nonce = 'b7cdabcabc3c4f7f91508da3bca9798f'
        signed_args = self.smugmug._get_oauth_request_params(url=url, parameters=parameters, method='POST', timestamp=timestamp, nonce=nonce)
        self.assertEqual(signed_args['oauth_signature'], 'f++GOXf9BhSVhGy1dxGSbmaA0ng=')
开发者ID:chrishoffman,项目名称:smugpy,代码行数:28,代码来源:test_oauth.py

示例2: TestApi

# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import reset_auth [as 别名]
class TestApi(unittest.TestCase):
    def setUp(self):
        self.smugmug = SmugMug(api_key=API_KEY, api_version='1.2.2', app_name='TestApp')

    def test_ping(self):
        rsp = self.smugmug.service_ping()
        self.assertEqual(rsp['stat'], 'ok')

    def test_dynamic_method(self):
        self.smugmug.login_anonymously()
        rsp = self.smugmug.albums_get(NickName='test')
        self.assertEqual(rsp['method'], 'smugmug.albums.get')
        self.smugmug.reset_auth()

    def test_authorize(self):
        expected = 'http://api.smugmug.com/services/oauth/authorize.mg?oauth_token=ABC&Access=Public&Permissions=Read'
        self.smugmug.set_oauth_token('ABC','123')
        url = self.smugmug.authorize(access='Public', perm='Read')
        self.assertEqual(url, expected)
        self.smugmug.reset_auth()

    def test_failed_api(self):
        if sys.version_info < (2, 7):
            self.assertRaises(SmugMugException, lambda: self.smugmug.bad_apimethod())
        else:
            with self.assertRaises(SmugMugException):
                self.smugmug.bad_apimethod()
开发者ID:Ramblurr,项目名称:smugpy,代码行数:29,代码来源:test_api.py

示例3: TestApiImageUploadOauth

# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import reset_auth [as 别名]
class TestApiImageUploadOauth(unittest.TestCase):
    def setUp(self):
        self.smugmug = SmugMug(api_key=API_KEY, api_version='1.3.0', app_name='TestApp', oauth_secret=OAUTH_SECRET)

    def test_image_upload_oauth(self):
        self.smugmug.set_oauth_token('ABC','123')
        rsp = self.smugmug.images_upload(File='tests/smuggy.jpg', AlbumID=1234)
        self.assertEqual(rsp['method'], 'smugmug.images.upload')
        self.smugmug.reset_auth()
开发者ID:Ramblurr,项目名称:smugpy,代码行数:11,代码来源:test_api.py

示例4: TestApiImageUpload

# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import reset_auth [as 别名]
class TestApiImageUpload(unittest.TestCase):
    def setUp(self):
        self.smugmug = SmugMug(api_key=API_KEY, api_version='1.2.2', app_name='TestApp')

    def test_image_upload_missing_param(self):
        self.smugmug.login_withHash(UserID='test', PasswordHash='ABCDE')
        if sys.version_info < (2, 7):
            self.assertRaises(SmugMugException, lambda: self.smugmug.images_upload())
        else:
            with self.assertRaises(SmugMugException):
                self.smugmug.images_upload()
        self.smugmug.reset_auth()

    def test_image_upload_without_auth(self):
        if sys.version_info < (2, 7):
            self.assertRaises(SmugMugException, lambda: self.smugmug.images_upload(File='tests/smuggy.jpg', AlbumID=1234))
        else:
            with self.assertRaises(SmugMugException):
                self.smugmug.images_upload(File='tests/smuggy.jpg', AlbumID=1234)
        self.smugmug.reset_auth()

    def test_image_upload(self):
        self.smugmug.login_withHash(UserID='test', PasswordHash='ABCDE')
        rsp = self.smugmug.images_upload(File='tests/smuggy.jpg', AlbumID=1234)
        self.assertEqual(rsp['method'], 'smugmug.images.upload')
        self.smugmug.reset_auth()

    def test_image_upload_with_filename(self):
        self.smugmug.login_withHash(UserID='test', PasswordHash='ABCDE')
        rsp = self.smugmug.images_upload(File='tests/smuggy.jpg', AlbumID=1234, FileName='rename.jpg')
        self.assertEqual(rsp['method'], 'smugmug.images.upload')
        self.smugmug.reset_auth()
开发者ID:Ramblurr,项目名称:smugpy,代码行数:34,代码来源:test_api.py

示例5: TestLogin

# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import reset_auth [as 别名]
class TestLogin(unittest.TestCase):
    def setUp(self):
        self.smugmug = SmugMug(api_key=API_KEY, api_version='1.2.2', app_name='TestApp')

    def test_login_anonymously(self):
        self.smugmug.login_anonymously()
        self.assertNotEqual(self.smugmug.session_id, None)
        self.smugmug.reset_auth()

    def test_login_withHash(self):
        self.smugmug.login_withHash(UserID='test', PasswordHash='ABCDE')
        self.assertNotEqual(self.smugmug.session_id, None)
        self.smugmug.reset_auth()

    def test_login_withPassword(self):
        self.smugmug.login_withPassword(EmailAddress='[email protected]', Password='ABC123')
        self.assertNotEqual(self.smugmug.session_id, None)
        self.smugmug.reset_auth()
开发者ID:Ramblurr,项目名称:smugpy,代码行数:20,代码来源:test_login.py


注:本文中的smugpy.SmugMug.reset_auth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。