Ejemplo n.º 1
0
def start_session(username="******",
                  password="******",
                  enterprise="enterprise",
                  api_url="https://*****:*****@enterprse.com"
    user.enterprise_id = "<enterprise_id>"
    user.enterprise_name = "enterprise"
    user.firstname = "John",
    user.id = "<user_id>"
    user.lastname = "Doe"
    user.role = "ROLE"

    # Set API KEY
    session._login_controller.api_key = user.api_key

    with patch.object(NURESTTestSession, "_authenticate", return_value=True):
        session.start()

    return user
Ejemplo n.º 2
0
    def test_to_dict(self):
        """ Get object as dictionary """

        user = User()
        user.id = 3
        user.user_name ="Christophe"
        user.password = '******'
        user.api_key = 'ABCD'

        to_dict = user.to_dict()

        self.assertEquals(to_dict['userName'], 'Christophe')
        self.assertEquals(to_dict['password'], 'sorry')
        self.assertEquals(to_dict['APIKey'], 'ABCD')
        self.assertEquals(to_dict['parentID'], None)
        self.assertEquals(to_dict['parentType'], None)
        self.assertEquals(to_dict['owner'], None)
        self.assertEquals(to_dict['creationDate'], None)
Ejemplo n.º 3
0
    def test_to_dict(self):
        """ Get object as dictionary """

        user = User()
        user.id = 3
        user.user_name = "Christophe"
        user.password = '******'
        user.api_key = 'ABCD'

        to_dict = user.to_dict()

        self.assertEquals(to_dict['userName'], 'Christophe')
        self.assertEquals(to_dict['password'], 'sorry')
        self.assertEquals(to_dict['APIKey'], 'ABCD')
        self.assertEquals(to_dict['parentID'], None)
        self.assertEquals(to_dict['parentType'], None)
        self.assertEquals(to_dict['owner'], None)
        self.assertEquals(to_dict['creationDate'], None)
Ejemplo n.º 4
0
def start_session(username="******", password="******", enterprise="enterprise", api_url="https://*****:*****@enterprse.com"
    user.enterprise_id ="<enterprise_id>"
    user.enterprise_name ="enterprise"
    user.firstname ="John",
    user.id ="<user_id>"
    user.lastname ="Doe"
    user.role ="ROLE"

    # Set API KEY
    session._login_controller.api_key = user.api_key

    # Activate session
    _NURESTSessionCurrentContext.session = session

    return user