Exemplo n.º 1
0
class TeamValidatorTest(ValidatorTestCase):
    def setUp(self):
        super(TeamValidatorTest, self).setUp()
        self.init_validator(validator.TeamValidator(None))
        self.team = self.teh.create_team('Foo')
    
    def testTeamValidatorAcceptsSerializedTeamInValueObject(self):
        self.assert_equals(self.team, self.validate(self.team.as_dict()))


class IterableIntValidatorTest(ValidatorTestCase):
    def setUp(self):
        self.super()
        self.init_validator(validator.MandatoryIterableIntValidator(''))
    
    def test_can_validate_int_list(self):
        self.assert_equals((1, 2, 3), self.validate(['1', 2, '3']))
    
    def test_rejects_non_integer_values_in_list(self):
        self.assert_error("fnord")
        self.assert_error(["fnord"])
        self.assert_error("12345")
        self.assert_error([None])
        self.assert_error(None)


if __name__ == '__main__':
    from agilo.test.testfinder import run_unit_tests
    run_unit_tests(__file__)

Exemplo n.º 2
0
    def test_create_ticket_command(self):
        """Tests the create ticket command"""
        cmd_create = TicketController.CreateTicketCommand(
            self.env, summary='This is a ticket')
        t = self.controller.process_command(cmd_create)
        self.assert_true(t.exists)
        self.assert_equals('This is a ticket', t[Key.SUMMARY])

    def test_save_ticket_command(self):
        """Tests the save ticket command"""
        cmd_create = TicketController.CreateTicketCommand(
            self.env, summary='This is a ticket')
        t = self.controller.process_command(cmd_create)
        self.assert_true(t.exists)
        self.assert_equals('This is a ticket', t[Key.SUMMARY])
        cmd_save = TicketController.SaveTicketCommand(
            self.env, ticket=t.id, properties={Key.DESCRIPTION: 'Hey!'})
        self.controller.process_command(cmd_save)
        # Now verify that the ticket has really been saved
        self.controller.manager.get_cache().invalidate()
        cmd_get = TicketController.GetTicketCommand(self.env, ticket=t.id)
        t_reloaded = self.controller.process_command(cmd_get)
        self.assert_not_none(t_reloaded)
        self.assert_equals('Hey!', t_reloaded[Key.DESCRIPTION])


if __name__ == '__main__':
    from agilo.test import testfinder
    testfinder.run_unit_tests(__file__)
Exemplo n.º 3
0
# -*- encoding: utf-8 -*-
#   Copyright 2009 Agile42 GmbH, Berlin (Germany)
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#   
#   Author: 
#       - Felix Schwarz <felix.schwarz__at__agile42.com>

from agilo.test.testfinder import run_unit_tests

if __name__ == '__main__':
    run_unit_tests(root_dir=__file__)

Exemplo n.º 4
0
# -*- encoding: utf-8 -*-

from agilo.test.testfinder import run_unit_tests

if __name__ == '__main__':
    run_unit_tests(root_dir=__file__)

Exemplo n.º 5
0
        cmd_create = TicketController.CreateTicketCommand(self.env,
                                                         summary='This is a ticket')
        t = self.controller.process_command(cmd_create)
        self.assert_true(t.exists)
        self.assert_equals('This is a ticket', t[Key.SUMMARY])
        
    def test_save_ticket_command(self):
        """Tests the save ticket command"""
        cmd_create = TicketController.CreateTicketCommand(self.env,
                                                          summary='This is a ticket')
        t = self.controller.process_command(cmd_create)
        self.assert_true(t.exists)
        self.assert_equals('This is a ticket', t[Key.SUMMARY])
        cmd_save = TicketController.SaveTicketCommand(self.env,
                                                      ticket=t.id,
                                                      properties={Key.DESCRIPTION: 'Hey!'})
        self.controller.process_command(cmd_save)
        # Now verify that the ticket has really been saved
        self.controller.manager.get_cache().invalidate()
        cmd_get = TicketController.GetTicketCommand(self.env,
                                                    ticket=t.id)
        t_reloaded = self.controller.process_command(cmd_get)
        self.assert_not_none(t_reloaded)
        self.assert_equals('Hey!', t_reloaded[Key.DESCRIPTION])
        

if __name__ == '__main__':
    from agilo.test import testfinder
    testfinder.run_unit_tests(__file__)

Exemplo n.º 6
0
# -*- encoding: utf-8 -*-
#   Copyright 2008 Agile42 GmbH, Berlin (Germany)
#   Copyright 2011 Agilo Software GmbH All rights reserved
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#   Authors: 
#       - Andrea Tomasini <andrea.tomasini__at__agile42.com>
#       - Roberto Bettazzoni <roberto.bettazzoni__at__agile42.com>

import agilo.utils.filterwarnings

from agilo.test.testfinder import run_unit_tests

if __name__ == '__main__':
    # Special case: Run all unit tests
    run_unit_tests()