Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
prozorro-sale
Procedure
Commits
1b99773d
Commit
1b99773d
authored
Jul 08, 2021
by
Mike Hoang
Browse files
fix(isCurrentTenant property): renamed isCurrentTenant -> bidderPriorityPresence
parent
ec916775
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/prozorro_sale/procedure/migration.py
View file @
1b99773d
import
importlib
import
os
CURRENT_VERSION
=
3
8
CURRENT_VERSION
=
3
9
def
get_m_files
():
...
...
src/prozorro_sale/procedure/migrations/039_llp_isCurrentTenant_renamt_to_bidderPriorityPresence.py
0 → 100644
View file @
1b99773d
def
apply
(
data
):
if
'legitimatePropertyLease-priorityEnglish'
in
data
.
get
(
'sellingMethod'
):
if
bids
:
=
data
.
get
(
'bids'
):
for
bid
in
bids
.
values
():
is_current_tenant
=
bid
.
pop
(
'isCurrentTenant'
,
None
)
if
isinstance
(
is_current_tenant
,
bool
):
bid
[
'bidderPriorityPresence'
]
=
is_current_tenant
return
data
src/prozorro_sale/procedure/models/schema/base.yml
View file @
1b99773d
...
...
@@ -1330,7 +1330,7 @@ schemas:
readOnly
:
true
type
:
number
format
:
float
isCurrentTenant
:
bidderPriorityPresence
:
readOnly
:
true
type
:
boolean
required
:
...
...
src/prozorro_sale/procedure/models/schema/legitimatePropertyLease.yml
View file @
1b99773d
...
...
@@ -674,7 +674,7 @@ schemas:
-
$ref
:
'
#/components/schemas/legitimatePropertyLease-english.Bid'
-
type
:
object
properties
:
isCurrentTenant
:
bidderPriorityPresence
:
type
:
boolean
default
:
false
readOnly
:
true
...
...
src/prozorro_sale/procedure/packages/legitimatePropertyLease/procedure.py
View file @
1b99773d
...
...
@@ -278,7 +278,7 @@ class PriorityBid(base.Bid):
import_roles
=
{
'owner'
:
(
role
.
ImportRoleChain
()
+
blacklist
(
'classification'
,
'
isCurrentTenant
'
)
+
blacklist
(
'classification'
,
'
bidderPriorityPresence
'
)
+
role
.
ImportStatusRole
({
'active_tendering'
},
whitelist
(
'bidders'
,
'status'
,
'value'
,
'unit'
,
'quantity'
,
'documents'
,
...
...
src/prozorro_sale/procedure/packages/legitimatePropertyLease/states.py
View file @
1b99773d
...
...
@@ -305,14 +305,14 @@ class PriorityTendering(Tendering):
return
False
def
checking_current_tenant_exist
(
self
):
if
len
([
x
for
x
in
self
.
procedure
.
bids
if
x
.
isCurrentTenant
is
True
and
x
.
status
==
'active'
])
>
1
:
if
len
([
x
for
x
in
self
.
procedure
.
bids
if
x
.
bidderPriorityPresence
is
True
and
x
.
status
==
'active'
])
>
1
:
raise
errors
.
DataError
({
'bidders'
:
{
'identifier'
:
{
'id'
:
'Bid for current tenant is already registered'
}}})
@
bidder
def
update_bid_status
(
self
,
bid_id
,
status
,
context
):
super
().
update_bid_status
(
bid_id
,
status
,
context
)
bid
=
self
.
procedure
.
bids
[
bid_id
]
bid
.
isCurrentTenant
=
self
.
check_bid_is_from_current_tenant
(
bid
)
bid
.
bidderPriorityPresence
=
self
.
check_bid_is_from_current_tenant
(
bid
)
self
.
checking_current_tenant_exist
()
...
...
src/prozorro_sale/procedure/packages/legitimatePropertyLease/types.py
View file @
1b99773d
...
...
@@ -103,8 +103,8 @@ class _CurrentTenantDeterminationMixin:
return
tenant_count
=
0
for
bid
in
value
:
bid
.
isCurrentTenant
=
self
.
check_bid_is_from_current_tenant
(
bid
)
if
bid
.
isCurrentTenant
and
bid
.
status
==
'active'
:
bid
.
bidderPriorityPresence
=
self
.
check_bid_is_from_current_tenant
(
bid
)
if
bid
.
bidderPriorityPresence
and
bid
.
status
==
'active'
:
tenant_count
+=
1
if
tenant_count
>
1
:
raise
DataError
({
'bidders'
:
{
'identifier'
:
{
'id'
:
'Bid for current tenant is already registered'
}}})
...
...
test/pytest/legitimatePropertyLease/priorityEnglish/priorityEnglish-initialQualification/test_qualification/test_qualification.py
View file @
1b99773d
...
...
@@ -41,11 +41,11 @@ class TestProcedureQualification:
assert
test_procedure
.
status
==
'active_qualification'
bid_1
=
test_procedure
.
bids
[
0
]
assert
bid_1
.
isCurrentTenant
is
True
assert
bid_1
.
bidderPriorityPresence
is
True
assert
bid_1
.
bidders
[
0
].
identifier
.
id
==
test_procedure
.
relatedOrganizations
.
currentTenant
.
identifier
.
id
bid_2
=
test_procedure
.
bids
[
-
1
]
assert
bid_2
.
isCurrentTenant
is
False
assert
bid_2
.
bidderPriorityPresence
is
False
assert
bid_2
.
bidders
[
0
].
identifier
.
id
!=
test_procedure
.
relatedOrganizations
.
currentTenant
.
identifier
.
id
with
pytest
.
raises
(
errors
.
DataError
,
match
=
'^{"bidders": {"identifier": '
...
...
test/pytest/legitimatePropertyLease/priorityEnglish/priorityEnglish/test_active_auction/test_auction_state.py
View file @
1b99773d
...
...
@@ -26,61 +26,61 @@ class TestAuctionState:
@
pytest
.
mark
.
parametrize
(
"bids"
,
[
pytest
.
param
([
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
100
},
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
],
id
=
'tenant_first'
),
pytest
.
param
([
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
100
},
],
id
=
'tenant_second'
),
pytest
.
param
([
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
90
},
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
],
id
=
'tenant_first with amount 90'
),
pytest
.
param
([
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
90
},
],
id
=
'tenant_second with amount 90'
),
pytest
.
param
([
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
110
},
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
],
id
=
'tenant_first with amount 110'
),
pytest
.
param
([
{
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'amount'
:
100
},
{
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'amount'
:
110
},
],
id
=
'tenant_second with amount 110'
),
...
...
@@ -92,7 +92,7 @@ class TestAuctionState:
for
idx
,
val
in
enumerate
(
bids
):
bids
[
idx
][
'bidders'
]
=
bid_data
[
'bidders'
]
bids
[
idx
][
"dateModified"
]
=
datetime
.
now
().
isoformat
()
if
val
[
'
isCurrentTenant
'
]:
if
val
[
'
bidderPriorityPresence
'
]:
bids
[
idx
][
'bidders'
][
0
][
'identifier'
][
'id'
]
=
tenant_id
else
:
bids
[
idx
][
'bidders'
][
0
][
'identifier'
][
'id'
]
=
not_tenant_id
...
...
@@ -114,7 +114,7 @@ class TestAuctionState:
assert
procedure
.
status
==
"active_auction"
for
ix
,
procedure_bid
in
enumerate
(
procedure
.
bids
):
assert
procedure_bid
.
isCurrentTenant
==
bids
[
ix
][
'isCurrentTenant
'
]
assert
procedure_bid
.
bidderPriorityPresence
==
bids
[
ix
][
'bidderPriorityPresence
'
]
procedure_bids
=
deepcopy
(
procedure
.
bids
)
auction_data_bids
=
{
...
...
@@ -134,9 +134,9 @@ class TestAuctionState:
assert
procedure
.
status
==
'active_qualification'
assert
len
(
procedure
.
awards
)
==
2
keys
=
list
(
auction_data_bids
.
keys
())
if
bids
[
0
][
'
isCurrentTenant
'
]:
assert
procedure_bids
[
procedure
.
awards
[
1
].
bidId
].
isCurrentTenant
if
bids
[
0
][
'
bidderPriorityPresence
'
]:
assert
procedure_bids
[
procedure
.
awards
[
1
].
bidId
].
bidderPriorityPresence
else
:
assert
procedure_bids
[
procedure
.
awards
[
0
].
bidId
].
isCurrentTenant
assert
procedure_bids
[
procedure
.
awards
[
0
].
bidId
].
bidderPriorityPresence
assert
procedure
.
awards
[
0
].
bidId
==
keys
[
0
]
assert
procedure
.
awards
[
1
].
bidId
==
keys
[
1
]
test/pytest/legitimatePropertyLease/priorityEnglish/priorityEnglish/test_qualification/test_qualification.py
View file @
1b99773d
...
...
@@ -12,13 +12,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
@@ -28,13 +28,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
@@ -44,13 +44,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -60,13 +60,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -76,13 +76,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -92,13 +92,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -108,13 +108,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
@@ -124,13 +124,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
@@ -140,13 +140,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
@@ -156,13 +156,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -172,13 +172,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -188,13 +188,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1001
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -204,13 +204,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
}
),
...
...
@@ -220,13 +220,13 @@ class TestProcedureQualification:
{
'id'
:
1
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
},
{
'id'
:
2
,
'amount'
:
1000
,
'
isCurrentTenant
'
:
False
,
'
bidderPriorityPresence
'
:
False
,
'date'
:
TODAY
+
timedelta
(
minutes
=
1
)
}
),
...
...
test/pytest/legitimatePropertyLease/priorityEnglish/priorityEnglish/test_tendering/test_tendering.py
View file @
1b99773d
...
...
@@ -29,25 +29,25 @@ class TestProcedureTendering(TenderingTest):
bid_info
=
test_procedure
.
create_bid
(
bid_data
,
acl_context
(
test_procedure
))
bid
=
test_procedure
.
bids
[
bid_info
[
'id'
]]
assert
bid
.
isCurrentTenant
is
is_current_tenant
assert
bid
.
bidderPriorityPresence
is
is_current_tenant
upd_data
=
{
'bidders'
:
bid_data
[
'bidders'
]
}
upd_data
[
'bidders'
][
0
][
'identifier'
][
'id'
]
=
upd_bidder_id
test_procedure
.
update_bid
(
bid
.
id
,
upd_data
,
acl_context
(
bid
))
assert
bid
.
isCurrentTenant
is
False
assert
bid
.
bidderPriorityPresence
is
False
test_procedure
.
update_bid_status
(
bid
.
id
,
'active'
,
acl_context
(
bid
))
assert
bid
.
isCurrentTenant
is
upd_is_current_tenant
assert
bid
.
bidderPriorityPresence
is
upd_is_current_tenant
def
test_bid_is_current_tenant_blacklisting
(
self
,
make_active_tendering_procedure
,
bid_data
,
re_item_data
,
acl_context
):
with
pytest
.
raises
(
errors
.
DataError
,
match
=
'^{"
isCurrentTenant
": "Cannot update with role owner"}$'
):
with
pytest
.
raises
(
errors
.
DataError
,
match
=
'^{"
bidderPriorityPresence
": "Cannot update with role owner"}$'
):
test_procedure
=
make_active_tendering_procedure
(
items
=
[
re_item_data
()]
)
bid_data
.
update
({
'
isCurrentTenant
'
:
True
'
bidderPriorityPresence
'
:
True
})
test_procedure
.
create_bid
(
bid_data
,
acl_context
(
test_procedure
))
...
...
@@ -67,7 +67,7 @@ class TestProcedureTendering(TenderingTest):
_bid_1_data
=
{
'bidders'
:
bid_data
[
'bidders'
],
'
isCurrentTenant
'
:
True
,
'
bidderPriorityPresence
'
:
True
,
}
_bid_1_data
[
'bidders'
][
0
][
'identifier'
][
'id'
]
=
tenant_id
...
...
@@ -115,13 +115,13 @@ class TestProcedureTendering(TenderingTest):
_bid_1_data
=
{
'bidders'
:
bid_data
[
'bidders'
],
'
isCurrentTenant
'
:
True
'
bidderPriorityPresence
'
:
True
}
_bid_1_data
[
'bidders'
][
0
][
'identifier'
][
'id'
]
=
tenant_id
_bid_2_data
=
{
'bidders'
:
bid_data
[
'bidders'
],
'
isCurrentTenant
'
:
True
'
bidderPriorityPresence
'
:
True
}
_bid_2_data
[
'bidders'
][
0
][
'identifier'
][
'id'
]
=
not_tenant_id
...
...
test/pytest/migrations/test_039.py
0 → 100644
View file @
1b99773d
import
os
import
pytest
from
bson
import
json_util
from
prozorro_sale.procedure.migration
import
_migrate
from
prozorro_sale.procedure.model_generator
import
load_procedure
@
pytest
.
fixture
def
prev_obj
(
migrations_dir
):
with
open
(
os
.
path
.
join
(
migrations_dir
,
'data'
,
'legitimatePropertyLease'
,
'priorityEnglish'
,
'obj_036.json'
))
as
obj_data
:
return
json_util
.
loads
(
obj_data
.
read
())
class
Test039
:
def
test_migration
(
self
,
prev_obj
):
for
bid
in
prev_obj
[
'bids'
].
values
():
assert
'isCurrentTenant'
in
bid
migrate_data
=
_migrate
(
prev_obj
)
for
bid
in
migrate_data
[
'bids'
].
values
():
assert
'bidderPriorityPresence'
in
bid
assert
'isCurrentTenant'
not
in
bid
load_procedure
(
migrate_data
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment