Commit da9a4e7e authored by dmitry.mashoshin's avatar dmitry.mashoshin
Browse files

Merge branch 'mashony/fix-snapshot-test' into 'master'

fix: freeze random value for success snapshot tests

See merge request !2015
parents fe5f985d a5d9c23e
from unittest import mock
from freezegun import freeze_time
from syrupy.filters import props
......@@ -5,30 +7,30 @@ from syrupy.filters import props
@freeze_time("2022-02-24")
class ProtectTest:
def test_protect_role(self, make_active_qualification_procedure, make_bid, acl_context, constants, snapshot):
with mock.patch('random.getrandbits', lambda: 1):
proc = make_active_qualification_procedure(
auctionPeriod={'startDate': "2022-03-15"},
bids=[
make_bid(status=constants.BidStatus.active, amount=3000, order=2),
make_bid(status=constants.BidStatus.active, amount=4000, order=1)
]
)
proc._protected = True
proc = make_active_qualification_procedure(
auctionPeriod={'startDate': "2022-03-15"},
bids=[
make_bid(status=constants.BidStatus.active, amount=3000, order=2),
make_bid(status=constants.BidStatus.active, amount=4000, order=1)
]
)
proc._protected = True
protected_primitive = proc.to_primitive(role='public')
protected_primitive = proc.to_primitive(role='public')
assert protected_primitive == \
snapshot(name="protected_primitive",
exclude=props("_id", "ownerToken", "bidId", "id", "datePublished",
"auctionId", "dateModified", "registryId",
"auctionPeriod", "currentContractTime"))
assert protected_primitive == \
snapshot(name="protected_primitive",
exclude=props("_id", "ownerToken", "bidId", "id", "datePublished",
"auctionId", "dateModified", "registryId",
"auctionPeriod", "currentContractTime"))
proc._protected = False
original_primitive = proc.to_primitive(
role='public')
proc._protected = False
original_primitive = proc.to_primitive(
role='public')
assert original_primitive == \
snapshot(name="original_primitive",
exclude=props("_id", "ownerToken", "bidId", "id", "datePublished",
"auctionId", "dateModified", "registryId",
"auctionPeriod", "currentContractTime"))
assert original_primitive == \
snapshot(name="original_primitive",
exclude=props("_id", "ownerToken", "bidId", "id", "datePublished",
"auctionId", "dateModified", "registryId",
"auctionPeriod", "currentContractTime"))
......@@ -1020,21 +1020,21 @@
'locationInBuilding': '***** ***** *****',
'powerSupplyCapacity': 123.123,
'powerSupplyClass': '*****',
'serviceAirConditioning': False,
'serviceAutonomousHeating': True,
'serviceCentralHeating': False,
'serviceAirConditioning': True,
'serviceAutonomousHeating': False,
'serviceCentralHeating': True,
'serviceElectricity': True,
'serviceElevator': False,
'serviceElevator': True,
'serviceFireAlarm': False,
'serviceGas': True,
'serviceHeatingCounter': False,
'serviceInternet': True,
'servicePhone': True,
'serviceHeatingCounter': True,
'serviceInternet': False,
'servicePhone': False,
'serviceSecurityAlarm': False,
'serviceSewerage': True,
'serviceTV': True,
'serviceVentilation': False,
'serviceWater': False,
'serviceTV': False,
'serviceVentilation': True,
'serviceWater': True,
'servicesAccounting': '***** ***** ***** ***** *****',
'servicesDescription': '***** ***** ***** ***** *****',
'totalBuildingArea': 12.12,
......@@ -1182,20 +1182,20 @@
'powerSupplyCapacity': 123.123,
'powerSupplyClass': '*****',
'serviceAirConditioning': True,
'serviceAutonomousHeating': True,
'serviceAutonomousHeating': False,
'serviceCentralHeating': True,
'serviceElectricity': True,
'serviceElevator': True,
'serviceFireAlarm': False,
'serviceGas': False,
'serviceGas': True,
'serviceHeatingCounter': True,
'serviceInternet': True,
'serviceInternet': False,
'servicePhone': False,
'serviceSecurityAlarm': True,
'serviceSecurityAlarm': False,
'serviceSewerage': True,
'serviceTV': False,
'serviceVentilation': False,
'serviceWater': False,
'serviceVentilation': True,
'serviceWater': True,
'servicesAccounting': '***** ***** ***** ***** *****',
'servicesDescription': '***** ***** ***** ***** *****',
'totalBuildingArea': 12.12,
......@@ -1483,7 +1483,7 @@
}),
}),
]),
'calcOnBookValue': False,
'calcOnBookValue': True,
'cancellations': list([
]),
'contracts': list([
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment