How to use the pyral.entity.InvalidRallyTypeNameError 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_recyclebin.py View on Github external
#!/usr/bin/env python

import sys, os
import types
import urllib
import py

from pyral import Rally
import pyral

InvalidRallyTypeNameError = pyral.entity.InvalidRallyTypeNameError
from pyral.query_builder import RallyUrlBuilder, RallyQueryFormatter

##################################################################################################

from rally_targets import AGICEN, AGICEN_USER, AGICEN_PSWD
from rally_targets import DEFAULT_WORKSPACE, NON_DEFAULT_PROJECT

##################################################################################################

def test_basic_query():
    """
        Using a known valid Rally server and known valid access credentials,
        issue a simple filtering query targeting RecycleBinEntry items
        whose Name value does not contain a specific value.
    """
    rally = Rally(server=AGICEN, user=AGICEN_USER, password=AGICEN_PSWD)
github RallyTools / RallyRestToolkitForPython / test / test_search.py View on Github external
#!/usr/bin/env python

import sys, os
import types
import py

from pyral import Rally
import pyral

InvalidRallyTypeNameError = pyral.entity.InvalidRallyTypeNameError

##################################################################################################

from internal_rally_targets import APIKEY, WORKSPACE, PROJECT

##################################################################################################

def test_basic_search():
    """
        Using a known valid Rally server and known valid access credentials,
        issue a simple search query (basic qualifying criteria).
    """
    rally = Rally(apikey=APIKEY, workspace=WORKSPACE, project=PROJECT)
    #
    #expectedErrMsg = u'The new search functionality is not turned on for your subscription'
    #
github RallyTools / RallyRestToolkitForPython / test / test_query.py View on Github external
#!/usr/bin/env python

import sys, os
import types
import urllib
import py

try:
    from urllib import unquote
except:
    from urllib.parse import unquote

import pyral
from pyral import Rally

InvalidRallyTypeNameError = pyral.entity.InvalidRallyTypeNameError
from pyral.query_builder import RallyUrlBuilder, RallyQueryFormatter

##################################################################################################

from rally_targets import AGICEN, AGICEN_USER, AGICEN_PSWD
from rally_targets import DEFAULT_WORKSPACE, DEFAULT_PROJECT, NON_DEFAULT_PROJECT
from rally_targets import BOONDOCKS_WORKSPACE, BOONDOCKS_PROJECT
from rally_targets import PROJECT_SCOPING_TREE

##################################################################################################

def test_basic_query():
    """
        Using a known valid Rally server and known valid access credentials,
        issue a simple query (no qualifying criteria) for a known valid 
        Rally entity.
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
_rally_entity_cache by virtue of being populated via a startup call
        to processSchemaInfo.
        Raise an exception when the candidate cannot be determined to be
        the ElementName of a valid Rally Type.
    """
    global _rally_entity_cache

    if candidate in _rally_entity_cache:
        return getEntityName(candidate)

    # Unfortunate hard-coding of standard Rally Portfolio item dyna-types
    if candidate in PORTFOLIO_ITEM_SUB_TYPES:
        pi_candidate = 'PortfolioItem/%s' % candidate
        return getEntityName(pi_candidate)

    raise InvalidRallyTypeNameError(candidate)
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
return schema[entity_name]


def _createClass(name, parentClass):
    """
        Dynamically create a class named for name whose parent is parent, and
        make the newly created class available by name in the global namespace.
    """
    rally_entity_class = type(name, (parentClass,), {})
    
    globals()[name] = rally_entity_class
    return rally_entity_class


__all__ = [processSchemaInfo, classFor, validRallyType, getSchemaItem,
           InvalidRallyTypeNameError, UnrecognizedAllowedValuesReference,
           PORTFOLIO_ITEM_SUB_TYPES
          ]
github RallyTools / RallyRestToolkitForPython / pyral / entity.py View on Github external
def inheritanceChain(self):
        """
            Find the chain of inheritance for this Rally Type.
            Exclude the basic Python object. 
            Return a list starting with the furthermost ancestor continuing on down to this Rally Type.
        """
        try:
            klass = classFor[self.Name.replace(' ', '')]
        except:
            pi_qualified_name = 'PortfolioItem_%s' % self.Name
            try:
                klass = classFor[pi_qualified_name.replace(' ', '')]
            except:
                raise InvalidRallyTypeNameError(self.Name)

        ancestors = []
        for ancestor in klass.mro():
            mo = re.search(r"'pyral\.entity\.(\w+)'", str(ancestor))
            if mo:
                ancestors.append(mo.group(1))
        ancestors.reverse()
        return ancestors