示例#1
0
    def test_users(self, vpp: VPP):
        cursor = vpp.users()
        while cursor.next():
            users = cursor.users
            print(users)

        print('cursor exhausted')
示例#2
0
def get_vpp() -> VPP:
    vpp = getattr(g, '_vpp', None)

    if vpp is None:
        g._vpp = VPP(current_app.config['VPP_STOKEN'])

    return vpp
示例#3
0
def get_vpp() -> VPP:
    vpp = getattr(g, '_vpp', None)

    if vpp is None:
        if 'VPP_STOKEN' not in current_app.config:
            raise VPPError('VPP stoken not configured')

        g._vpp = VPP(current_app.config['VPP_STOKEN'])

    return vpp
示例#4
0
    def test_licenses(self, vpp: VPP):
        cursor = vpp.licenses(VPP_BATCH_LICENSE_ADAMID)
        licenses = []
        total = cursor.total
        assert len(cursor.licenses) == 600
        licenses = licenses + cursor.licenses

        while cursor.next():
            licenses = licenses + cursor.licenses

        assert len(licenses) == total
示例#5
0
    def test_manage_one_license(self, vpp: VPP):
        op = vpp.manage(VPP_BATCH_LICENSE_ADAMID)

        op.add(LicenseAssociationType.ClientUserID, VPP_MOCK_USER_CID)
        vpp.save(op)
        
示例#6
0
 def test_get_assets(self, vpp: VPP):
     reply = vpp.assets()
     assert 'assets' in reply
示例#7
0
 def test_edit_user_by_client_id(self, vpp: VPP):
     reply = vpp.edit_user(client_user_id=VPP_MOCK_USER_CID, email=VPP_MOCK_USER_EMAIL_2)
     assert reply['status'] == 0
     assert reply['user']['email'] == VPP_MOCK_USER_EMAIL_2
示例#8
0
 def test_retireuser_by_client_id(self, vpp: VPP):
     reply = vpp.retire_user(client_user_id=VPP_MOCK_USER_CID)
     assert reply['status'] == 0
示例#9
0
 def test_getuser_by_user_id(self, vpp: VPP):
     reply = vpp.get_user(user_id=VPP_MOCK_USER_ID)
     assert reply['status'] == 0
     assert 'user' in reply
示例#10
0
 def test_vpp_register_user(self, vpp: VPP):
     reply = vpp.register_user(VPP_MOCK_USER_CID, VPP_MOCK_USER_EMAIL)
     assert reply['status'] == 0
     assert 'user' in reply
示例#11
0
def vpp(simulator_token: str) -> VPP:
    return VPP(
        stoken=simulator_token,
        vpp_service_config_url='http://localhost:8080/VPPServiceConfigSrv',
        service_config=SERVICE_CONFIG)