• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python schema.Schema类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中assembl.graphql.schema.Schema的典型用法代码示例。如果您正苦于以下问题:Python Schema类的具体用法?Python Schema怎么用?Python Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Schema类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_mutation_delete_template_also_deletes_associated_vote_specifications

def test_mutation_delete_template_also_deletes_associated_vote_specifications(graphql_request, vote_session, vote_proposal, graphql_registry, test_session):
    mutation = graphql_registry['createTokenVoteSpecification']
    vote_session_id = to_global_id("VoteSession", vote_session.id)
    from assembl.graphql.schema import Schema as schema
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "voteSessionId": vote_session_id,
        "titleEntries": [],
        "instructionsEntries":
        [
            {"value": u"Try to copy the TCP feed, maybe it will navigate the mobile system!", "localeCode": "en"}
        ],
        "isCustom": False,
        "exclusiveCategories": False,
        "tokenCategories": [
            {
                "titleEntries": [{"value": u"In favor", "localeCode": "en"}],
                "typename": "positive",
                "totalNumber": 9,
                "color": 'green'
            }
        ]
    })
    assert res.errors is None
    template_id = res.data['createTokenVoteSpecification']['voteSpecification']['id']
    proposal_id = to_global_id("Idea", vote_proposal.id)

    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "voteSessionId": vote_session_id,
        "proposalId": proposal_id,
        "voteSpecTemplateId": template_id,
        "titleEntries": [],
        "instructionsEntries":
        [
            {"value": u"I'll compress the multi-byte THX protocol, that should panel the SDD monitor!", "localeCode": "en"}
        ],
        "isCustom": True,
        "exclusiveCategories": False,
        "tokenCategories": []
    })
    assert res.errors is None

    # delete the template
    mutation = graphql_registry['deleteVoteSpecification']
    vote_spec_id = res.data['createTokenVoteSpecification']['voteSpecification']['id']
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "id": template_id
    })
    assert res.errors is None
    assert res.data['deleteVoteSpecification']['success'] is True
    # the template and the vote spec have been deleted
    assert test_session.query(models.TokenVoteSpecification).count() == 0
开发者ID:assembl,项目名称:assembl,代码行数:51,代码来源:test_graphql_vote_session.py


示例2: thematic_with_image

def thematic_with_image(phases, graphql_request):
    from assembl.graphql.schema import Schema as schema
    import os
    from io import BytesIO

    class FieldStorage(object):
        file = BytesIO(os.urandom(16))
        filename = u'path/to/image.png'
        type = 'image/png'

    graphql_request.POST['variables.file'] = FieldStorage()
    res = schema.execute(u"""
mutation createThematicWithImage($file: String!) {
    createThematic(
        messageViewOverride: "survey",
        titleEntries:[
            {value:"You can't program the card without transmitting the wireless AGP card!", localeCode:"en"}
        ],
        discussionPhaseId: """+unicode(phases['survey'].id)+u""",
        image: $file
    ) {
        thematic {
            ... on Idea {
                id,
                img { externalUrl }
            }
        }
    }
}
""", context_value=graphql_request, variable_values={ "file": "variables.file" })
    thematic_id = res.data['createThematic']['thematic']['id']
    return thematic_id
开发者ID:assembl,项目名称:assembl,代码行数:32,代码来源:graphql.py


示例3: number_gauge_vote_specification_associated_to_proposal

def number_gauge_vote_specification_associated_to_proposal(request, test_session, discussion, graphql_request, vote_session, number_gauge_vote_specification, vote_proposal, graphql_registry):
    mutation = graphql_registry['createNumberGaugeVoteSpecification']
    vote_session_id = to_global_id("VoteSession", vote_session.id)
    proposal_id = to_global_id("Idea", vote_proposal.id)
    template_gauge_vote_spec_id = to_global_id("NumberGaugeVoteSpecification", number_gauge_vote_specification.id)
    from assembl.graphql.schema import Schema as schema
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "voteSessionId": vote_session_id,
        "proposalId": proposal_id,
        "voteSpecTemplateId": template_gauge_vote_spec_id,
        "titleEntries": [
            {"value": u"Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Understanding the dynamics and issues", "localeCode": "en"}
        ],
        "instructionsEntries":
        [
            {"value": u"Instructions : Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Instructions: Understanding the dynamics and issues", "localeCode": "en"}
        ],
        "isCustom": True,
        "minimum": 0.0,
        "maximum": 60.0,
        "nbTicks": 7,
        "unit": u"M€"
    })
    assert res.errors is None
    vote_spec = vote_session.vote_specifications[-1]

    def fin():
        print "finalizer number_gauge_vote_specification_associated_to_proposal"
        test_session.delete(vote_spec)
        test_session.flush()

    request.addfinalizer(fin)
    return vote_spec
开发者ID:assembl,项目名称:assembl,代码行数:35,代码来源:vote_session.py


示例4: vote_proposal

def vote_proposal(request, test_session, discussion, graphql_request, vote_session, graphql_registry):
    mutation = graphql_registry['createProposal']
    vote_session_id = to_global_id("VoteSession", vote_session.id)
    from assembl.graphql.schema import Schema as schema
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "voteSessionId": vote_session_id,
        "titleEntries": [
            {"value": u"Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Understanding the dynamics and issues", "localeCode": "en"}
        ],
        "descriptionEntries": [
            {"value": u"Description: Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Description: Understanding the dynamics and issues", "localeCode": "en"}
        ]
    })
    assert res.errors is None
    proposal = vote_session.idea.children[0]

    def fin():
        print "finalizer vote_proposal"
        test_session.delete(proposal)
        test_session.flush()

    request.addfinalizer(fin)
    return proposal
开发者ID:assembl,项目名称:assembl,代码行数:25,代码来源:vote_session.py


示例5: create_proposal_x

def create_proposal_x(graphql_request, first_question_id, idx, publication_state):
    from assembl.graphql.schema import Schema as schema
    from assembl.models import PublicationStates
    body = "une proposition {}".format(idx)
    if publication_state == PublicationStates.SUBMITTED_AWAITING_MODERATION.value:
        body = "une proposition en attente de validation {}".format(idx)

    res = schema.execute(u"""
mutation myFirstMutation {
    createPost(
        ideaId:"%s",
        body:"%s"
        publicationState:%s
    ) {
        post {
            ... on Post {
                id,
                body,
                creator { name },
            }
        }
    }
}
""" % (first_question_id, body, publication_state),
        context_value=graphql_request)
    return res.data['createPost']['post']['id']
开发者ID:assembl,项目名称:assembl,代码行数:26,代码来源:graphql.py


示例6: thematic_with_question

def thematic_with_question(phases, graphql_request):
    from assembl.graphql.schema import Schema as schema
    res = schema.execute(u"""
mutation myMutation {
    createThematic(
        messageViewOverride: "survey",
        titleEntries:[
            {value:"Comprendre les dynamiques et les enjeux", localeCode:"fr"},
            {value:"Understanding the dynamics and issues", localeCode:"en"}
        ],
        questions:[
            {titleEntries:[
                {value:"Comment qualifiez-vous l'emergence de l'Intelligence Artificielle dans notre société ?", localeCode:"fr"}
            ]},
        ],
        discussionPhaseId: """+unicode(phases['survey'].id)+u""",
    ) {
        thematic {
            ... on Idea {
                id,
                titleEntries { localeCode value },
                questions { id, titleEntries { localeCode value } }
            }
        }
    }
}
""", context_value=graphql_request)
    thematic_id = res.data['createThematic']['thematic']['id']
    first_question_id = res.data['createThematic']['thematic']['questions'][0]['id']
    return thematic_id, first_question_id
开发者ID:assembl,项目名称:assembl,代码行数:30,代码来源:graphql.py


示例7: test_mutation_add_extracts

def test_mutation_add_extracts(graphql_request, top_post_in_thread_phase):
  post_db_id = int(from_global_id(top_post_in_thread_phase)[1])
  
  extract_body = u"manger des choux à la crème"
  xpathStart = u"//div[@id='message-body-local:Content/%s']/" % post_db_id
  xpathEnd = xpathStart
  offsetStart = 17
  offsetEnd = 44

  variable_values = {
    "extracts": [
      {
        "postId": top_post_in_thread_phase,
        "body": extract_body,
        "xpathStart": xpathStart,  
        "xpathEnd": xpathEnd,
        "offsetStart": offsetStart,
        "offsetEnd": offsetEnd,
        "lang": "fr"
      }
    ],
    "extractState": "SUBMITTED",
    "extractNature": "actionable_solution" 
  }

  post = models.AssemblPost.get(post_db_id)
  db = post.db
  def get_extracts():
      return db.query(
        models.Extract
        ).join(
        models.Content, models.Extract.content == post
        ).options(joinedload(models.Extract.text_fragment_identifiers)).all()

  assert len(get_extracts()) == 0
  res = schema.execute(u"""
mutation AddPostsExtract($extracts: [PostExtractEntryInput]!, $extractState: ExtractStates, $extractNature: ExtractNatures) {
  addPostsExtract(extracts: $extracts, extractState: $extractState, extractNature: $extractNature) {
    status
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'addPostsExtract': {
      u'status': True
    }
  }
  assert len(get_extracts()) == 1

  # add the same extract
  res = schema.execute(u"""
mutation AddPostsExtract($extracts: [PostExtractEntryInput]!, $extractState: ExtractStates, $extractNature: ExtractNatures) {
  addPostsExtract(extracts: $extracts, extractState: $extractState, extractNature: $extractNature) {
    status
  }
}
""", context_value=graphql_request, variable_values=variable_values)
  # The extract must be ignored
  assert len(get_extracts()) == 1
开发者ID:assembl,项目名称:assembl,代码行数:60,代码来源:test_graphql_extracts.py


示例8: test_delete_resource

def test_delete_resource(graphql_registry, graphql_request, resource):
    resource_id = to_global_id('Resource', resource.id)
    res = schema.execute(
        graphql_registry['deleteResource'],
        variable_values={
            "resourceId": resource_id
        },
        context_value=graphql_request)
    assert res.data['deleteResource']['success'] is True
    res = schema.execute(
        u'query { resources { id } }', context_value=graphql_request)
    assert json.loads(json.dumps(res.data)) == {u'resources': []}
开发者ID:assembl,项目名称:assembl,代码行数:12,代码来源:test_graphql_resources_center.py


示例9: test_query_associate_vote_spec_to_proposal

def test_query_associate_vote_spec_to_proposal(graphql_request, timeline_vote_session, vote_session, vote_proposal, token_vote_specification, graphql_registry):
    mutation = graphql_registry['createTokenVoteSpecification']
    vote_session_id = to_global_id("VoteSession", vote_session.id)
    proposal_id = to_global_id("Idea", vote_proposal.id)
    # token vote spec similar to token_vote_specification fixture, but with exclusiveCategories set to False
    template_token_vote_spec_id = to_global_id("TokenVoteSpecification", token_vote_specification.id)
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "voteSessionId": vote_session_id,
        "proposalId": proposal_id,
        "voteSpecTemplateId": template_token_vote_spec_id,
        "titleEntries": [
            {"value": u"Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Understanding the dynamics and issues", "localeCode": "en"}
        ],
        "instructionsEntries":
        [
            {"value": u"Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
            {"value": u"Understanding the dynamics and issues", "localeCode": "en"}
        ],
        "isCustom": True,
        "exclusiveCategories": False,
        "tokenCategories": [
            {"titleEntries": [
                {"value": u"Comprendre les dynamiques et les enjeux", "localeCode": "fr"},
                {"value": u"Understanding the dynamics and issues", "localeCode": "en"}
             ],
             "typename": "positive",
             "totalNumber": 10,
             "color": 'red'
            }
        ]
    })
    query = graphql_registry['VoteSession']
    res = schema.execute(query, context_value=graphql_request, variable_values={
        "ideaId": to_global_id('Idea',vote_session.idea_id),
        "lang": "en"
    })
    assert res.errors is None
    proposal_id = to_global_id("Idea", vote_proposal.id)
    assert len(res.data['voteSession']['modules']) == 1  # only vote spec not associated to a proposal
    assert res.data['voteSession']['modules'][0]['exclusiveCategories'] == True
    assert len(res.data['voteSession']['proposals'][0]['modules']) == 1
    assert res.data['voteSession']['proposals'][0]['modules'][0]['exclusiveCategories'] == False
    assert res.data['voteSession']['proposals'][0]['modules'][0]['voteSpecTemplateId'] == template_token_vote_spec_id
    assert res.data['voteSession']['proposals'][0]['modules'][0]['isCustom'] is True

    # clean up
    vote_session.vote_specifications[-1].delete()
    vote_session.db.flush()
开发者ID:assembl,项目名称:assembl,代码行数:49,代码来源:test_graphql_vote_session.py


示例10: test_query_tags

def test_query_tags(graphql_request, extract_post_1_to_subidea_1_1):
  variable_values = {
    "filter": ''
  }

  res = schema.execute(u"""
query tags($filter: String) {
  tags(filter: $filter) {
    value
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'tags': [{u'value': u'foo'}, {u'value': u'bar'}]
  }

  variable_values = {
    "filter": 'f'
  }

  res = schema.execute(u"""
query tags($filter: String) {
  tags(filter: $filter) {
    value
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'tags': [{u'value': u'foo'}]
  }

  variable_values = {
    "filter": 'test'
  }

  res = schema.execute(u"""
query tags($filter: String) {
  tags(filter: $filter) {
    value
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'tags': []
  }
开发者ID:assembl,项目名称:assembl,代码行数:48,代码来源:test_graphql_tags.py


示例11: test_mutation_update_text_field

def test_mutation_update_text_field(graphql_request, graphql_registry, text_field):
    text_field_id = to_global_id('TextField', text_field.id)
    res = schema.execute(
        graphql_registry['updateTextField'],
        context_value=graphql_request,
        variable_values={
            "id": text_field_id,
            "lang": u"en",
            "titleEntries": [
                { "localeCode": "en", "value": u"My new title" },
                { "localeCode": "be", "value": u"Mon nouveau titre" },
            ],
            "order": 8.0,
            "required": False,
            "hidden": False
        })
    assert res.errors is None
    assert 'updateTextField' in res.data
    field = res.data['updateTextField']['field']
    assert field[u'required'] is False
    assert field[u'hidden'] is False
    assert field[u'order'] == 8.0
    title_entries = field['titleEntries']
    assert title_entries[0]['localeCode'] == u'be'
    assert title_entries[0]['value'] == u'Mon nouveau titre'
    assert title_entries[1]['localeCode'] == u'en'
    assert title_entries[1]['value'] == u'My new title'
开发者ID:assembl,项目名称:assembl,代码行数:27,代码来源:test_graphql_configurable_fields.py


示例12: test_mutation_create_text_field

def test_mutation_create_text_field(graphql_request, graphql_registry, test_session):
    from assembl.models.configurable_fields import TextField
    res = schema.execute(
        graphql_registry['createTextField'],
        context_value=graphql_request,
        variable_values={
            "lang": u"en",
            "titleEntries": [
                { "localeCode": "en", "value": u"My new field" }
            ],
            "order": 4.0,
            "required": False,
            "hidden": False
        })
    assert res.errors is None
    assert 'createTextField' in res.data
    new_field = res.data['createTextField']['field']
    assert new_field[u'required'] is False
    assert new_field[u'hidden'] is False
    assert new_field[u'order'] == 4.0
    title_entries = new_field['titleEntries']
    assert title_entries[0]['localeCode'] == u'en'
    assert title_entries[0]['value'] == u'My new field'
    saobj = TextField.get(from_global_id(new_field[u'id'])[1])
    test_session.delete(saobj)
开发者ID:assembl,项目名称:assembl,代码行数:25,代码来源:test_graphql_configurable_fields.py


示例13: test_query_landing_page_module_types

def test_query_landing_page_module_types(graphql_request):
    query = u"""query LandingPageModuleTypes($lang: String!) {
        landingPageModuleTypes {
            titleEntries {
                localeCode
                value
            }
            title(lang: $lang)
            defaultOrder
            editableOrder
            identifier
            required
        }
    }
    """
    res = schema.execute(
        query,
        context_value=graphql_request,
        variable_values={"lang": u"en"})
    assert res.errors is None
    assert len(res.data['landingPageModuleTypes']) == MODULES_COUNT
    for module_type in res.data['landingPageModuleTypes']:
        if module_type['identifier'] == 'INTRODUCTION':
            assert module_type['title'] == u'Text & Multimedia'
            assert module_type['defaultOrder'] == 2.0
            assert module_type['editableOrder'] is True
            assert module_type['required'] is False
开发者ID:assembl,项目名称:assembl,代码行数:27,代码来源:test_graphql_landing_page.py


示例14: test_query_vote_session_proposals

def test_query_vote_session_proposals(graphql_request, timeline_vote_session, vote_session, vote_proposal, graphql_registry):

    query = graphql_registry['VoteSession']
    res = schema.execute(query, context_value=graphql_request, variable_values={
        "ideaId": to_global_id('Idea', vote_session.idea_id),
        "lang": "en"
    })
    assert res.errors is None
    proposal_id = to_global_id("Idea", vote_proposal.id)
    assert json.loads(json.dumps(res.data['voteSession']['proposals'])) == [{
        u'id': proposal_id,
        u'order': 1.0,
        u'title': u'Understanding the dynamics and issues',
        u'description': u'Description: Understanding the dynamics and issues',
        u'titleEntries': [
            {u'localeCode': u'en',
             u'value': u'Understanding the dynamics and issues'},
            {u'localeCode': u'fr',
             u'value': u'Comprendre les dynamiques et les enjeux'}],
        u'descriptionEntries': [
            {u'localeCode': u'en',
              u'value': u'Description: Understanding the dynamics and issues'},
            {u'localeCode': u'fr',
              u'value': u'Description: Comprendre les dynamiques et les enjeux'}],
        u'modules': [],
        u'voteResults': {u'numParticipants': 0, u'participants': []}
        }]
开发者ID:assembl,项目名称:assembl,代码行数:27,代码来源:test_graphql_vote_session.py


示例15: test_graphql_get_profile

def test_graphql_get_profile(graphql_request, participant1_user):
    res = schema.execute(u"""
query User($id: ID!) {
    user: node(id: $id) {
      ... on AgentProfile {
        id
        name
        username
        displayName
        email
        creationDate
        image { externalUrl }
        hasPassword
      }
    }
  }
""", context_value=graphql_request, variable_values={
        "id": to_global_id('AgentProfile', participant1_user.id)
    })
    assert res.errors is None
    assert res.data['user']['name'] == u'A. Barking Loon'
    assert res.data['user']['username'] is None
    assert res.data['user']['displayName'] == u'A. Barking Loon'
    assert res.data['user']['email'] == u'[email protected]'
    # 2018-01-04T12:08:44.735489+00:00
    assert u'T' in res.data['user']['creationDate']
    assert res.data['user']['image'] is None
    assert res.data['user']['hasPassword']
开发者ID:assembl,项目名称:assembl,代码行数:28,代码来源:test_graphql_user.py


示例16: test_query_resources

def test_query_resources(graphql_registry, discussion, resource, resource_with_image_and_doc, graphql_request):
    res = schema.execute(
        graphql_registry['ResourcesQuery'],
        variable_values={
            "lang": u"en"
        },
        context_value=graphql_request)
    assert res.data['resources'][0]['order'] == 1.0
    assert res.data['resources'][1]['order'] == 2.0

    first_resource = res.data['resources'][0]
    second_resource = res.data['resources'][1]

    assert first_resource['title'] == u'another resource'
    assert second_resource['title'] == u'a resource'

    assert second_resource['text'] == u'Lorem ipsum dolor sit amet'
    assert second_resource['embedCode'] == u'<iframe ...>'
    assert second_resource['doc'] == None
    assert second_resource['image'] == None

    assert '/documents/' in first_resource['image']['externalUrl']
    assert '/documents/' in first_resource['doc']['externalUrl']
    # this is the title of the File object, not the title of the ResourceAttachment object
    assert first_resource['doc']['title'] == "mydocument.pdf"
开发者ID:assembl,项目名称:assembl,代码行数:25,代码来源:test_graphql_resources_center.py


示例17: test_graphql_get_synthesis

def test_graphql_get_synthesis(graphql_request,
                               user_language_preference_en_cookie,
                               synthesis_in_syntheses):
    synthesis_id = synthesis_in_syntheses.data['syntheses'][0]['id']
    res = schema.execute(
        u"""query SynthesisQuery($id: ID!, $lang: String) {
            synthesis: node(id: $id) {
              ... on Synthesis {
                id
                subject(lang: $lang)
                ideas {
                  ... on Idea {
                    id
                    live {
                      ... on Idea {
                        id
                        img { externalUrl }
                      }
                    }
                  }
                }
              }
            }
          }
        """,
        context_value=graphql_request,
        variable_values={
             "id": synthesis_id,
            "lang": "en"
        })
    assert len(res.data) == 1
    synthesis = res.data['synthesis']
    assert synthesis['subject'] == 'subject EN'
    assert len(synthesis['ideas']) == 2
开发者ID:assembl,项目名称:assembl,代码行数:34,代码来源:test_graphql_syntheses.py


示例18: test_mutation_confirm_extract

def test_mutation_confirm_extract(graphql_request, extract_with_range_submitted_in_reply_post_1):
  from assembl.models import ExtractStates
  state = extract_with_range_submitted_in_reply_post_1.extract_state
  assert ExtractStates.SUBMITTED.value == state
  extract_graphql_db_id = to_global_id('Extract',extract_with_range_submitted_in_reply_post_1.id)

  variable_values = {
    "extractId": extract_graphql_db_id
  }

  res = schema.execute(u"""
mutation confirmExtract($extractId: ID!) {
  confirmExtract(extractId: $extractId) {
    success
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'confirmExtract': {
      u'success': True
    }
  }
  state = extract_with_range_submitted_in_reply_post_1.extract_state
  assert ExtractStates.PUBLISHED.value == state
开发者ID:assembl,项目名称:assembl,代码行数:25,代码来源:test_graphql_extracts.py


示例19: test_mutation_update_extract_tags

def test_mutation_update_extract_tags(graphql_request, extract_post_1_to_subidea_1_1):
  extract_graphql_db_id = to_global_id('Extract',extract_post_1_to_subidea_1_1.id)
  tags = ['foo', 'bar', 'tar']

  variable_values = {
    "id": extract_graphql_db_id,
    "tags" : tags
  }

  res = schema.execute(u"""
mutation updateExtractTags(
  $id: ID!
  $tags: [String]
) {
  updateExtractTags(
    id: $id
    tags: $tags
  ) {
    tags {
      value
    }
  }
}
""", context_value=graphql_request, variable_values=variable_values)

  assert json.loads(json.dumps(res.data)) == {
    u'updateExtractTags': {
      u'tags': [{u'value': u'foo'}, {u'value': u'bar'}, {u'value': u'tar'}]
    }
  }
开发者ID:assembl,项目名称:assembl,代码行数:30,代码来源:test_graphql_extracts.py


示例20: test_mutation_update_proposal

def test_mutation_update_proposal(graphql_request, discussion, vote_proposal, graphql_registry):
    mutation = graphql_registry['updateProposal']
    proposal_id = to_global_id("Idea", vote_proposal.id)
    res = schema.execute(mutation, context_value=graphql_request, variable_values={
        "id": proposal_id,
        "titleEntries": [
            {"value": u"Comprendre les dynamiques et les enjeux (updated)", "localeCode": "fr"},
            {"value": u"Understanding the dynamics and issues (updated)", "localeCode": "en"}
        ],
        "descriptionEntries": [
            {"value": u"Description: Comprendre les dynamiques et les enjeux (updated)", "localeCode": "fr"},
            {"value": u"Description: Understanding the dynamics and issues (updated)", "localeCode": "en"}
        ]
    })
    assert res.errors is None
    assert json.loads(json.dumps(res.data)) == {
u'updateProposal': {
    u'proposal': {
        u'id': proposal_id,
        u'order': 1.0,
        u'titleEntries': [
            {u'localeCode': u'en',
             u'value': u'Understanding the dynamics and issues (updated)'},
            {u'localeCode': u'fr',
             u'value': u'Comprendre les dynamiques et les enjeux (updated)'}],
        u'descriptionEntries': [
            {u'localeCode': u'en',
              u'value': u'Description: Understanding the dynamics and issues (updated)'},
            {u'localeCode': u'fr',
              u'value': u'Description: Comprendre les dynamiques et les enjeux (updated)'}]
        }}}
开发者ID:assembl,项目名称:assembl,代码行数:31,代码来源:test_graphql_vote_session.py



注:本文中的assembl.graphql.schema.Schema类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.get函数代码示例发布时间:2022-05-24
下一篇:
Python util.get_permissions函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap