def test_MRTracingPolicies_length(self, fixture_MRTracingPolicies_length): """ Verifies whether MRTracingPolicies assigns correctly each initial attributte passed and assigns a rigth value to mr_length_in_steps when mr_stop_mode is setted as length. """ kwargs = fixture_MRTracingPolicies_length tracing_policies = MRTracingPolicies(**kwargs) tracing_policies.set_mr_length_in_steps(timedelta(days=0.5)) for k, v in zip(kwargs.keys(), kwargs.values()): assert getattr(tracing_policies, k) == v assert tracing_policies.mr_length_in_steps == 28
def test_MRTracingPolicies_raise_error_mr_groups( self, fixture_MRTracingPolicies_error_validation): """ Verifies whether MRTracingPolicies class raises a ValidationError when target_groups are not in mr_groups. """ kwargs = fixture_MRTracingPolicies_error_validation[5] with pytest.raises(ValidationError, match=("All `target_groups` must be in")): MRTracingPolicies(**kwargs)
def test_MRTracingPolicies_level_number( self, fixture_MRTracingPolicies_level_number): """ Verifies whether MRTracingPolicies assigns correctly each initial attribute when mr_stop_mode is setted as level_number. """ kwargs = fixture_MRTracingPolicies_level_number tracing_policies = MRTracingPolicies(**kwargs) for k, v in zip(kwargs.keys(), kwargs.values()): assert getattr(tracing_policies, k) == v
def test_MRTracingPolicies_raise_error_mrt_stop_mode_level_length_1( self, fixture_MRTracingPolicies_error_validation): """ Verifies whether MRTracingPolicies class raises a ValidationError when mr_stop_mode is setting as length, and mr_length is not provided. """ kwargs = fixture_MRTracingPolicies_error_validation[2] with pytest.raises(ValidationError, match="A valid value for `mr_length` was expected"): MRTracingPolicies(**kwargs)
def test_MRTracingPolicies_raise_error_mrt_stop_mode_level_number_1( self, fixture_MRTracingPolicies_error_validation): """ Verifies whether MRTracingPolicies class raises a ValidationError when mr_stop_mode is setting as level_number, and unrestricted_time attribute is not provided. """ kwargs = fixture_MRTracingPolicies_error_validation[0] with pytest.raises( ValidationError, match="A valid value for `mr_stop_level` was expected"): MRTracingPolicies(**kwargs)
def test_MRTracingPolicies_raise_error_mrt_stop_mode_level_length_3( self, fixture_MRTracingPolicies_error_validation): """ Verifies whether MRTracingPolicies class raises a ValidationError when mr_stop_mode is setting as length, and mr_stop_level is provided. """ kwargs = fixture_MRTracingPolicies_error_validation[4] with pytest.raises(ValidationError, match=(f"`mr_stop_mode` was set to\n\ `{MRTStopModes.length}`.\n\ So, `mr_stop_level` should not be provided.")): MRTracingPolicies(**kwargs)
def test_MRTracingPolicies_raise_error_mrt_stop_mode_level_number_2( self, fixture_MRTracingPolicies_error_validation): """ Verifies whether MRTracingPolicies class raises a ValidationError when mr_stop_mode is setting as level_number, and mr_length & mr_length_units attribute is provided. """ kwargs = fixture_MRTracingPolicies_error_validation[1] with pytest.raises(ValidationError, match=(f"`mr_stop_mode` was set to\n\ `{MRTStopModes.level_number}`.\n\ So, `mr_length` and `mr_length_units`\n\ should not be provided.")): MRTracingPolicies(**kwargs)