コード例 #1
0
ファイル: test_api.py プロジェクト: yalay/115wangpan
class PublicAPITests(TestCase):
    """Test public methods"""
    def __init__(self, *args, **kwargs):
        """Initialize once for all test functions in this TestCase"""
        super(PublicAPITests, self).__init__(*args, **kwargs)
        self.api = API()
        self.api.login(section='test')

    def test_get_storage_info(self):
        storage_info = self.api.get_storage_info()
        assert 'total' in storage_info
        assert 'used' in storage_info

    def test_task_count(self):
        task_count = self.api.task_count
        assert isinstance(task_count, int)
        assert task_count >= 0

    def test_task_quota(self):
        task_quota = self.api.task_quota
        assert isinstance(task_quota, int)

    def test_get_user_info(self):
        user_info = self.api.get_user_info()
        assert isinstance(user_info, dict)

    def test_user_id(self):
        user_id = self.api.user_id
        assert int(user_id)

    def test_username(self):
        username = self.api.username
        assert isinstance(username, str)
コード例 #2
0
ファイル: test_api.py プロジェクト: shichao-an/115wangpan
class PublicAPITests(TestCase):
    """Test public methods"""
    def __init__(self, *args, **kwargs):
        """Initialize once for all test functions in this TestCase"""
        super(PublicAPITests, self).__init__(*args, **kwargs)
        self.api = API()
        self.api.login(section='test')

    def test_get_storage_info(self):
        storage_info = self.api.get_storage_info()
        assert 'total' in storage_info
        assert 'used' in storage_info

    def test_task_count(self):
        task_count = self.api.task_count
        assert isinstance(task_count, int)
        assert task_count >= 0

    def test_task_quota(self):
        task_quota = self.api.task_quota
        assert isinstance(task_quota, int)

    def test_get_user_info(self):
        user_info = self.api.get_user_info()
        assert isinstance(user_info, dict)

    def test_user_id(self):
        user_id = self.api.user_id
        assert int(user_id)

    def test_username(self):
        username = self.api.username
        assert isinstance(username, str)