How to use the pyral.query_builder.RallyQueryFormatter.parenGroups function in pyral

To help you get started, we’ve selected a few pyral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RallyTools / RallyRestToolkitForPython / test / test_query.py View on Github external
def test_query_target_value_with_ampersand():
    """
        Query for a Project.Name = 'R&D'
    """
    criteria = ['Project.Name = R&D']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name = R&D'.replace('&', '%26')

    criteria = ['Project.Name = "R&D"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name = "R&D"'.replace('&', '%26')

    criteria = ['Project.Name contains "R&D"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name contains "R&D"'.replace('&', '%26')

    criteria = 'Railhead.Company.Name != "Atchison Topeka & Santa Fe & Cunard Lines"'
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == criteria.replace('&', '%26')
github RallyTools / RallyRestToolkitForPython / test / test_query.py View on Github external
def test_query_target_value_with_and():
    """
        Query for a Project.Name = 'Operations and Support Group'
    """
    criteria = 'Project.Name = "Operations and Support Group"'
    result = RallyQueryFormatter.parenGroups(criteria)
    assert result == 'Project.Name = "Operations and Support Group"'.replace(' ', '%20')

    criteria = ['State != Open', 'Name !contains "Henry Hudson and Company"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert result.replace('%21%3D', '!=') == '(State != Open) AND (Name !contains "Henry Hudson and Company")'.replace(' ', '%20')
github RallyTools / RallyRestToolkitForPython / test / test_query.py View on Github external
def test_query_target_value_with_and():
    """
        Query for a Project.Name = 'Operations and Support Group'
    """
    criteria = 'Project.Name = "Operations and Support Group"'
    result = RallyQueryFormatter.parenGroups(criteria)
    assert result == 'Project.Name = "Operations and Support Group"'.replace(' ', '%20')

    criteria = ['State != Open', 'Name !contains "Henry Hudson and Company"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert result.replace('%21%3D', '!=') == '(State != Open) AND (Name !contains "Henry Hudson and Company")'.replace(' ', '%20')
github RallyTools / RallyRestToolkitForPython / test / test_query.py View on Github external
Query for a Project.Name = 'R&D'
    """
    criteria = ['Project.Name = R&D']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name = R&D'.replace('&', '%26')

    criteria = ['Project.Name = "R&D"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name = "R&D"'.replace('&', '%26')

    criteria = ['Project.Name contains "R&D"']
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == 'Project.Name contains "R&D"'.replace('&', '%26')

    criteria = 'Railhead.Company.Name != "Atchison Topeka & Santa Fe & Cunard Lines"'
    result = RallyQueryFormatter.parenGroups(criteria)
    assert unquote(result) == criteria.replace('&', '%26')
github RallyTools / RallyRestToolkitForPython / pyral / query_builder.py View on Github external
def build(self, pretty=None):
        if pretty:
            self.pretty = True
        
        resource = "{0}?".format(self.entity)

        qualifiers = ['fetch=%s' % self.fetch]
        if self.query:
##
##            print("RallyQueryFormatter raw query: %s" % self.query)
##
            query_string = RallyQueryFormatter.parenGroups(self.query)
##
##            print("query_string: |query=(%s)|" % query_string)
##
            qualifiers.append("query=(%s)" % query_string)
        if self.order:
            qualifiers.append("order=%s" % quote(self.order))
        if self.workspace:
            qualifiers.append(self.workspace)
        if self.project:
            qualifiers.append(self.project)
        if self.scopeUp:
            qualifiers.append(self.scopeUp)
        if self.scopeDown:
            qualifiers.append(self.scopeDown)

        qualifiers.append('pagesize=%s' % self.pagesize)