Beispiel #1
0
    def test_no_user(self):
        """ Retrieve all users but there are none """
        # Setup the response for MockServer
        BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
        url = '/identityAPI/getUsers'
        code = 200
        xml = build_xml_set([])
        BonitaServer.set_response_list([[url, code, xml]])

        users = BonitaUser.find_all()

        assert isinstance(users, list)
        assert len(users) == 0
Beispiel #2
0
    def test_some_users(self):
        """ Retrieve all users """
        # Setup the response for MockServer
        BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
        url = '/identityAPI/getUsers'
        code = 200
        user1_xml = build_bonita_user_xml(uuid='996633', password='', username='******')
        user2_xml = build_bonita_user_xml(uuid='112345', password='', username='******')
        xml = build_xml_set([user1_xml, user2_xml])
        BonitaServer.set_response_list([[url, code, xml]])

        users = BonitaUser.find_all()

        assert isinstance(users, list)
        assert len(users) == 2

        for user in users:
            assert isinstance(user, BonitaUser)

        sorted_users = sorted(users, key=lambda user: user.uuid)
        assert sorted_users[0].uuid == u'112345'
        assert sorted_users[1].uuid == u'996633'