Skip to content

Commit

Permalink
Merge pull request #239 from johnpooch/develop
Browse files Browse the repository at this point in the history
0.4.1
  • Loading branch information
johnpooch authored Apr 28, 2021
2 parents 32bcab6 + d18dc72 commit c2fd7a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adjudicator/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class OrderSchema(Schema):
source = Territory(required=True, load_only=True)
target = Territory(missing=None, load_only=True)
aux = Territory(missing=None, load_only=True)
target_coast = fields.Int(missing=None, load_only=True)
target_coast = fields.String(missing=None, load_only=True)
via_convoy = fields.Boolean(missing=False, load_only=True)
illegal = fields.Boolean(missing=False, dump_only=True)
illegal_code = fields.String(missing=None, dump_only=True)
Expand Down
18 changes: 16 additions & 2 deletions adjudicator/tests/test_serializers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.test import TestCase

from adjudicator.base import Phase, Season
from adjudicator.base import OrderType, PieceType, Phase, Season
from adjudicator.nation import Nation
from adjudicator.order import Hold
from adjudicator.piece import Army
from adjudicator.schema import TurnSchema
from adjudicator.schema import OrderSchema, TurnSchema
from adjudicator.territory import CoastalTerritory
from .base import AdjudicatorTestCaseMixin

Expand Down Expand Up @@ -61,3 +61,17 @@ def test_serialize_nation(self):
['id', 'next_turn_piece_count', 'next_turn_supply_center_count',
'next_turn_supply_delta']
)


class TestDeserializeOrder(AdjudicatorTestCaseMixin, TestCase):

def test_deserialize_build_with_target_coast(self):
data = {
'id': 1,
'type': OrderType.BUILD,
'nation': 'standard-russia',
'source': 'standard-st-petersburg',
'target_coast': 'standard-st-petersburg-north-coast',
'piece_type': PieceType.FLEET,
}
OrderSchema().load(data)

0 comments on commit c2fd7a1

Please sign in to comment.