Ejemplo n.º 1
0
    def test_CanPlaceStone_PlaceWhiteStoneAfterWhiteMove_RaisesException(self):
        "Checking if user with white stones can place stone after white move"

        # Validate stone
        stone = {'board': 1, 'user': 2, 'row': 0, 'col': 2, 'color': 1}
        form = StoneCreateForm(data=stone)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_002'])
Ejemplo n.º 2
0
    def test_Coordinates_CheckExistingStone_RaisesException(self):
        "Checking stone with existing coordinates."

        # Validate stone
        stone = {'board': 1, 'user': 1, 'row': 0, 'col': 1, 'color': 0}
        form = StoneCreateForm(data=stone)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_001'])
Ejemplo n.º 3
0
Archivo: forms.py Proyecto: somnam/xo
    def test_CanPlaceStone_PlaceWhiteStoneAfterWhiteMove_RaisesException(self):
        "Checking if user with white stones can place stone after white move"

        # Validate stone
        stone = { 'board': 1, 'user': 2, 'row': 0, 'col': 2, 'color': 1 }
        form  = StoneCreateForm(data=stone)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_002'])
Ejemplo n.º 4
0
Archivo: forms.py Proyecto: somnam/xo
    def test_Coordinates_CheckExistingStone_RaisesException(self):
        "Checking stone with existing coordinates."

        # Validate stone
        stone = { 'board': 1, 'user': 1, 'row': 0, 'col': 1, 'color': 0 }
        form  = StoneCreateForm(data=stone)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_001'])
Ejemplo n.º 5
0
    def test_CanPlaceStone_PlaceBlackStoneAfterBlackMove_RaisesException(self):
        "Checking if user with black stones can place stone after black move"

        # Create new black stone on board
        stone = Stone(board_id=1, user_id=1, row=0, col=2, color=0)
        stone.save()

        # Place next black stone
        stone = Stone(board_id=1, user_id=1, row=0, col=3, color=0)
        form = StoneCreateForm(data=model_to_dict(stone))
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_002'])
Ejemplo n.º 6
0
Archivo: forms.py Proyecto: somnam/xo
    def test_CanPlaceStone_PlaceBlackStoneAfterBlackMove_RaisesException(self):
        "Checking if user with black stones can place stone after black move"

        # Create new black stone on board
        stone = Stone(board_id=1, user_id=1, row=0, col=2, color=0)
        stone.save()

        # Place next black stone
        stone = Stone(board_id=1, user_id=1, row=0, col=3, color=0)
        form  = StoneCreateForm(data=model_to_dict(stone))
        self.assertFalse(form.is_valid())
        self.assertEqual(form.non_field_errors(), [u'ERR_STONE_002'])