Skip to content

Commit

Permalink
18804 add foreign jurisdiction region (bcgov#2370)
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh-menon-aot authored Jan 8, 2024
1 parent 3e0b6f9 commit 403b189
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""add_foreign_jurisdiction_region_amalgamating_business
Revision ID: f978e34aa8bb
Revises: 5238dd8fb805
Create Date: 2024-01-08 12:43:33.140159
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'f978e34aa8bb'
down_revision = '5238dd8fb805'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('amalgamating_business', sa.Column('foreign_jurisdiction_region', sa.String(length=10), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('amalgamating_business', 'foreign_jurisdiction_region')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions legal-api/src/legal_api/models/amalgamating_business.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Role(BaseEnum):
id = db.Column(db.Integer, primary_key=True)
role = db.Column('role', db.Enum(Role), nullable=False)
foreign_jurisdiction = db.Column('foreign_jurisdiction', db.String(10))
foreign_jurisdiction_region = db.Column('foreign_jurisdiction_region', db.String(10))
foreign_name = db.Column('foreign_name', db.String(100))
foreign_corp_num = db.Column('foreign_corp_num', db.String(50))

Expand Down
59 changes: 31 additions & 28 deletions legal-api/tests/unit/models/test_amalgamating_business.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,51 +38,54 @@
factory_user,
)


def test_valid_amalgamating_business_save(session):
"""Assert that a valid alias can be saved."""
identifier = 1234567

b = factory_business('CP1234567')
b.save()

filing = factory_filing(b, ANNUAL_REPORT)
filing.save()

amalgamation = Amalgamation(
id = identifier,
amalgamation_type = Amalgamation.AmalgamationTypes.horizontal,
business_id = b.id,
filing_id = filing.id,
amalgamation_date = datetime.utcnow(),
court_approval = True
id=identifier,
amalgamation_type=Amalgamation.AmalgamationTypes.horizontal,
business_id=b.id,
filing_id=filing.id,
amalgamation_date=datetime.utcnow(),
court_approval=True
)

amalgamation.save()

amalgamating_business_1 = AmalgamatingBusiness(
id = identifier,
role = AmalgamatingBusiness.Role.AMALGAMATING,
foreign_jurisdiction = "Alberta",
foreign_name = "Testing123",
foreign_corp_num = "123456789",
business_id = b.id,
amalgamation_id = amalgamation.id
id=identifier,
role=AmalgamatingBusiness.Role.AMALGAMATING,
foreign_jurisdiction="CA",
foreign_jurisdiction_region="AB",
foreign_name="Testing123",
foreign_corp_num="123456789",
business_id=b.id,
amalgamation_id=amalgamation.id
)
amalgamating_business_1.save()

identifier = 1234568

amalgamating_business_2 = AmalgamatingBusiness(
id = identifier,
role = AmalgamatingBusiness.Role.HOLDING,
foreign_jurisdiction = "Alberta",
foreign_name = "Testing123",
foreign_corp_num = "123456789",
business_id = b.id,
amalgamation_id = amalgamation.id
id=identifier,
role=AmalgamatingBusiness.Role.HOLDING,
foreign_jurisdiction="CA",
foreign_jurisdiction_region="AB",
foreign_name="Testing123",
foreign_corp_num="123456789",
business_id=b.id,
amalgamation_id=amalgamation.id
)
amalgamating_business_2.save()

# verify
assert amalgamating_business_1.id
assert amalgamating_business_2.id
Expand Down

0 comments on commit 403b189

Please sign in to comment.