test_allMembersRanking.py 3.44 KB
'''
Author: jipeigong 2017年7月19日17:53:38
'''

from atdd.MobileApiTest import MobileApiTest
from tests.Integral.IntergralAPP.test_getDepartments import GetDepartments

class AllMembersRanking(MobileApiTest):

    interfaceUrl = "/Integral/Api/Integral/GetAllRanking"

    def setUp(self):
        self.do_login()

    # 积分排名->参数为空
    def test_ranking_none(self):
        result = self.MobileApiTest(self.interfaceUrl)
        print(result)
        return result

    # 积分排名->总排行
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_all(self):
        data = {
            "ranking_type": 1
        }
        result = self.MobileApiTest(self.interfaceUrl, data)
        print(result)
        return result

    # 积分排名->日排行
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_day(self):
        data = {
            "ranking_type": 2
        }
        result = self.MobileApiTest(self.interfaceUrl, data)
        print(result)
        return result

    # 积分排名->周排行
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_week(self):
        data = {
            "ranking_type": 3
        }
        result = self.MobileApiTest(self.interfaceUrl, data)
        print(result)
        return result

    # 积分排名->月排行
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_month(self):
        data = {
            "ranking_type": 4
        }
        result = self.MobileApiTest(self.interfaceUrl, data)
        print(result)
        return result



    # 该员工所有上级部门的排名->总排名
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_dpId_all(self):

        dpIdList = GetDepartments().member_dpID()  # 部门ID list

        for i in range(len(dpIdList)):
            data = {
                "dp_id": dpIdList[i],
                "ranking_type": 1
            }
            result = self.MobileApiTest(self.interfaceUrl, data)
            print(result)

    # 该员工所有上级部门的排名->日排名
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_dpId_day(self):

        dpIdList = GetDepartments().member_dpID()  # 部门ID list

        for i in range(len(dpIdList)):
            data = {
                "dp_id": dpIdList[i],
                "ranking_type": 2
            }
            result = self.MobileApiTest(self.interfaceUrl, data)
            print(result)

    # 该员工所有上级部门的排名->周排名
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_dpId_week(self):

        dpIdList = GetDepartments().member_dpID()  # 部门ID list

        for i in range(len(dpIdList)):
            data = {
                "dp_id": dpIdList[i],
                "ranking_type": 3
            }
            result = self.MobileApiTest(self.interfaceUrl, data)
            print(result)

    # 该员工所有上级部门的排名->月排名
    # ranking_type: 1-总排行 2-日排行 3-周排行 4-月排行
    def test_ranking_dpId_month(self):

        dpIdList = GetDepartments().member_dpID()  # 部门ID list

        for i in range(len(dpIdList)):
            data = {
                "dp_id": dpIdList[i],
                "ranking_type": 4
            }
            result = self.MobileApiTest(self.interfaceUrl, data)
            print(result)