Example #1
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Media(work_session, cas_session.authority_token)
        media = app.create('testMedia', 'test media url', 'test media desc', [{'id':0, 'name': "ca1"}, {'id':0, 'name':'ca2'}])
        if media:
            media_id = media['id']
            media['url'] = 'aaaaaa, bb dsfsdf  erewre'
            media['description'] = 'aaaaaa, bb'
            media['catalog'] = [{'id':0, 'name': "ca1"}, {'id':0, 'name':'ca2'}, {'id':0, 'name': 'ca3'}]
            media = app.update(media)
            if not media:
                print('update media failed')
            elif len(media['catalog']) != 3:
                print('update media failed, media len invalid')
            else:
                pass
            media = app.query(media_id)
            if not media:
                print('query media failed')
            elif media['url'] != 'aaaaaa, bb dsfsdf  erewre':
                print('update media failed, content invalid')

            if not app.find_all():
                print('query_all media failed')
            app.destroy(media_id)
        else:
            print('create media failed')

        cas_session.logout(cas_session.authority_token)
Example #2
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Group(work_session, cas_session.authority_token)
        group = app.create('testGorup1', 'test description', {'id':0, 'name':'test'})
        if group:
            group_id = group['id']
            group['description'] = 'aaaaaa'
            group = app.save(group)
            if group and (group['description'] != 'aaaaaa'):
                print('update group failed')

            group = app.find(group_id)
            if group:
                if group['description'] != 'aaaaaa':
                    print('find group failed')
            else:
                print('find group failed')

            app.find_all()

            if not app.destroy(group_id):
                print('destroy group failed')

        else:
            print('create group failed')

        cas_session.logout(cas_session.authority_token)
Example #3
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123')
    app.status(app.authority_token)
    app.logout('123')
    app.logout(app.authority_token)
Example #4
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Link(work_session, cas_session.authority_token)
        link = app.create('testLink', 'test link url', 'test link logo',
                          [{
                              'id': 0,
                              'name': "ca1"
                          }, {
                              'id': 0,
                              'name': 'ca2'
                          }])
        if link:
            link_id = link['id']
            link['url'] = 'aaaaaa, bb dsfsdf  erewre aa'
            link['logo'] = 'test link logo'
            link['catalog'] = [{
                'id': 0,
                'name': "ca1"
            }, {
                'id': 0,
                'name': 'ca2'
            }, {
                'id': 0,
                'name': 'ca3'
            }]
            link = app.update(link)
            if not link:
                print('update link failed')
            elif len(link['catalog']) != 3:
                print('update link failed, link len invalid')
            else:
                pass
            link = app.query(link_id)
            if not link:
                print('query link failed')
            elif link['url'] != 'aaaaaa, bb dsfsdf  erewre aa':
                print('update link failed, content invalid')

            if not app.find_all():
                print('query_all link failed')

            app.destroy(link_id)
        else:
            print('create link failed')

        cas_session.logout(cas_session.authority_token)
Example #5
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Content(work_session, cas_session.authority_token)
        app.refresh(cas_session.authority_token)
        app.mock()
        app.remove()
        app.verify()

        cas_session.logout(cas_session.authority_token)
Example #6
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Article(work_session, cas_session.authority_token)
        article = app.create('testArticle', 'test article content',
                             [{
                                 'id': 0,
                                 'name': "ca1"
                             }, {
                                 'id': 0,
                                 'name': 'ca2'
                             }])
        if article:
            article_id = article['id']
            article['content'] = 'aaaaaa, bb dsfsdf  erewre'
            article['catalog'] = [{
                'id': 0,
                'name': "ca1"
            }, {
                'id': 0,
                'name': 'ca2'
            }, {
                'id': 0,
                'name': 'ca3'
            }]
            article = app.update(article)
            if not article:
                print('update article failed')
            elif len(article['catalog']) != 3:
                print('update article failed, article len invalid')
            else:
                pass
            article = app.query(article_id)
            if not article:
                print('query article failed')
            elif article['content'] != 'aaaaaa, bb dsfsdf  erewre':
                print('update article failed, content invalid')

            if not app.find_all():
                print('query_all article failed')

            app.destroy(article_id)
        else:
            print('create article failed')

        cas_session.logout(cas_session.authority_token)
Example #7
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Cache('http://localhost:8888', cas_session.authority_token)
        token = app.put_in("Test")
        if token:
            if not app.fetch_out(token):
                print("fetch out failed")

            if not app.remove(token):
                print("remove failed")
        else:
            print("put in cache failed")
    cas_session.logout(cas_session.authority_token)
Example #8
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('cas failed')
    else:
        app = User(work_session, cas_session.authority_token)
        user = app.create('testUser12', '123', '*****@*****.**',
                          [{
                              'id': 0,
                              'name': '系统管理组'
                          }])
        if user:
            user_id = user['id']
            if not app.update_password(user, '123456'):
                print("updatepassword failed")

            user['email'] = '*****@*****.**'
            user = app.update(user)
            if user:
                if user['email'] != '*****@*****.**':
                    print('update user failed')
            else:
                print('update user failed')

            user = app.find(user_id)
            if user:
                if user['email'] != '*****@*****.**':
                    print('find user failed')
            else:
                print('find user failed')

            app.destroy(user_id)

            app.find_all()
        else:
            print('create user failed')

        cas_session.logout(cas_session.authority_token)
Example #9
0
def main():
    'main'
    work_session = session.MagicSession('http://*****:*****@muidea.com', '123'):
        print('login failed')
    else:
        app = Catalog(work_session, cas_session.authority_token)
        catalog = app.create('testCatalog', 'testDescription', [{'id':0, 'name': "ca1"}, {'id':0, 'name':'ca2'}])
        if catalog:
            temp = app.create('testCatalog2', 'testDescription', [{'id':catalog['id'], 'name': catalog['name']}, {'id':0, 'name':'ca4'}])
            app.destroy(temp['id'])

            catalog_id = catalog['id']
            catalog['description'] = 'aaaaaa'
            catalog['catalog'] = [{'id':0, 'name': "ca1"}, {'id':0, 'name':'ca2'}, {'id':0, 'name': 'ca3'}]
            catalog = app.update(catalog)
            if not catalog:
                print('update catalog failed')
            elif len(catalog['catalog']) != 3:
                print('update catalog failed, catalog len invalid')
            else:
                pass
            catalog = app.query(catalog_id)
            if not catalog:
                print('query catalog failed')
            elif catalog['description'] != 'aaaaaa':
                print('update catalog failed, description invalid')

            if not app.find_all():
                print('query_all catalog failed')

            app.destroy(catalog_id)
        else:
            print('create catalog failed')

        cas_session.logout(cas_session.authority_token)