@@ -69,7 +69,7 @@ async def _creator(
6969 assert result
7070 row = await result .first ()
7171 assert row
72- properties = GroupExtraProperties .from_row_proxy (row )
72+ properties = GroupExtraProperties .from_row (row )
7373 created_properties .append ((properties .group_id , properties .product_name ))
7474 return properties
7575
@@ -365,115 +365,3 @@ async def test_get_aggregated_properties_for_user_returns_property_values_as_tru
365365 assert aggregated_group_properties .internet_access is False
366366 assert aggregated_group_properties .override_services_specifications is False
367367 assert aggregated_group_properties .use_on_demand_clusters is True
368-
369-
370- async def test_get_aggregated_properties_for_user_returns_property_values_as_truthy_if_one_of_them_is_v2 (
371- asyncpg_engine : AsyncEngine ,
372- connection : aiopg .sa .connection .SAConnection ,
373- connection_factory : aiopg .sa .connection .SAConnection | AsyncConnection ,
374- product_name : str ,
375- registered_user : RowProxy ,
376- create_fake_product : Callable [[str ], Awaitable [Row ]],
377- create_fake_group : Callable [..., Awaitable [RowProxy ]],
378- create_fake_group_extra_properties : Callable [..., Awaitable [GroupExtraProperties ]],
379- everyone_group_id : int ,
380- ):
381- await create_fake_product (product_name )
382- await create_fake_product (f"{ product_name } _additional_just_for_fun" )
383-
384- # create a specific extra properties for group that disallow everything
385- everyone_group_extra_properties = await create_fake_group_extra_properties (
386- everyone_group_id ,
387- product_name ,
388- internet_access = False ,
389- override_services_specifications = False ,
390- use_on_demand_clusters = False ,
391- )
392- # this should return the everyone group properties
393- aggregated_group_properties = (
394- await GroupExtraPropertiesRepo .get_aggregated_properties_for_user_v2 (
395- asyncpg_engine , user_id = registered_user .id , product_name = product_name
396- )
397- )
398- assert aggregated_group_properties == everyone_group_extra_properties
399-
400- # now we create some standard groups and add the user to them and make everything false for now
401- standard_groups = [await create_fake_group (connection ) for _ in range (5 )]
402- for group in standard_groups :
403- await create_fake_group_extra_properties (
404- group .gid ,
405- product_name ,
406- internet_access = False ,
407- override_services_specifications = False ,
408- use_on_demand_clusters = False ,
409- )
410- await _add_user_to_group (
411- connection_factory , user_id = registered_user .id , group_id = group .gid
412- )
413-
414- # now we still should not have any of these value Truthy
415- aggregated_group_properties = (
416- await GroupExtraPropertiesRepo .get_aggregated_properties_for_user_v2 (
417- asyncpg_engine , user_id = registered_user .id , product_name = product_name
418- )
419- )
420- assert aggregated_group_properties .internet_access is False
421- assert aggregated_group_properties .override_services_specifications is False
422- assert aggregated_group_properties .use_on_demand_clusters is False
423-
424- # let's change one of these standard groups
425- random_standard_group = random .choice (standard_groups ) # noqa: S311
426- result = await connection .execute (
427- groups_extra_properties .update ()
428- .where (groups_extra_properties .c .group_id == random_standard_group .gid )
429- .values (internet_access = True )
430- )
431- assert result .rowcount == 1
432-
433- # now we should have internet access
434- aggregated_group_properties = (
435- await GroupExtraPropertiesRepo .get_aggregated_properties_for_user_v2 (
436- asyncpg_engine , user_id = registered_user .id , product_name = product_name
437- )
438- )
439- assert aggregated_group_properties .internet_access is True
440- assert aggregated_group_properties .override_services_specifications is False
441- assert aggregated_group_properties .use_on_demand_clusters is False
442-
443- # let's change another one of these standard groups
444- random_standard_group = random .choice (standard_groups ) # noqa: S311
445- result = await connection .execute (
446- groups_extra_properties .update ()
447- .where (groups_extra_properties .c .group_id == random_standard_group .gid )
448- .values (override_services_specifications = True )
449- )
450- assert result .rowcount == 1
451-
452- # now we should have internet access and service override
453- aggregated_group_properties = (
454- await GroupExtraPropertiesRepo .get_aggregated_properties_for_user_v2 (
455- asyncpg_engine , user_id = registered_user .id , product_name = product_name
456- )
457- )
458- assert aggregated_group_properties .internet_access is True
459- assert aggregated_group_properties .override_services_specifications is True
460- assert aggregated_group_properties .use_on_demand_clusters is False
461-
462- # and we can deny it again by setting a primary extra property
463- # now create some personal extra properties
464- personal_group_extra_properties = await create_fake_group_extra_properties (
465- registered_user .primary_gid ,
466- product_name ,
467- internet_access = False ,
468- use_on_demand_clusters = True ,
469- )
470- assert personal_group_extra_properties
471-
472- aggregated_group_properties = (
473- await GroupExtraPropertiesRepo .get_aggregated_properties_for_user_v2 (
474- asyncpg_engine , user_id = registered_user .id , product_name = product_name
475- )
476- )
477- assert aggregated_group_properties .internet_access is False
478- assert aggregated_group_properties .override_services_specifications is False
479- assert aggregated_group_properties .use_on_demand_clusters is True
0 commit comments