コード例 #1
0
ファイル: test_user.py プロジェクト: julozi/pybonita
    def test_unknown_user(self):
        """ Try to retrieve user by username but no user matching """
        BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
        url = '/identityAPI/getUser'
        code = 500
        xml = build_dumb_bonita_error_body('UserNotFoundException', message='can\'t find User: unknown')
        BonitaServer.set_response_list([[url, code, xml]])

        user = BonitaUser.get_by_username('unknown')

        assert user is None
コード例 #2
0
ファイル: test_user.py プロジェクト: julozi/pybonita
    def test_known_user(self):
        """ Retrieve a user using the username """
        # Setup the response for MockServer
        BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
        url = '/identityAPI/getUser'
        code = 200
        xml = build_bonita_user_xml(uuid='996633', password='', username='******')
        BonitaServer.set_response_list([[url, code, xml]])

        user = BonitaUser.get_by_username('known')

        assert isinstance(user, BonitaUser)
        assert user.username == 'known'