1414@pytest .mark .parametrize ("kwargs" , [{}, {"policy" : "on_demand" }])
1515def test_remote_from_bandersnatch_config (kwargs , python_bindings , add_to_cleanup , tmp_path ):
1616 """Verify whether it's possible to create a remote from a Bandersnatch config."""
17- filename = tmp_path / "bandersnatch.conf"
17+ filename = str ( tmp_path / "bandersnatch.conf" )
1818 with open (filename , mode = "wb" ) as config :
1919 config .write (BANDERSNATCH_CONF )
2020 config .flush ()
2121 name = str (uuid .uuid4 ())
22- remote = python_bindings .RemotesPythonApi .from_bandersnatch (filename , name , ** kwargs ). to_dict ()
23- add_to_cleanup (python_bindings .RemotesPythonApi , remote [ " pulp_href" ] )
22+ remote = python_bindings .RemotesPythonApi .from_bandersnatch (filename , name , ** kwargs )
23+ add_to_cleanup (python_bindings .RemotesPythonApi , remote . pulp_href )
2424 expected = _gen_expected_remote_body (name , ** kwargs )
2525 for key , val in expected .items ():
26- assert remote [ key ] == val
26+ assert getattr ( remote , key ) == val
2727
2828
2929@pytest .mark .parallel
@@ -40,16 +40,18 @@ def test_remote_default_policy(python_bindings, gen_object_with_cleanup, monitor
4040
4141
4242@pytest .mark .parallel
43- def test_remote_invalid_project_specifier (python_bindings ):
43+ def test_remote_invalid_project_specifier (python_bindings , has_pulp_plugin ):
4444 """Test that creating a remote with an invalid project specifier fails."""
4545 # Test an include specifier without a "name" field.
4646 body = {
4747 "name" : str (uuid .uuid4 ()),
4848 "url" : "https://test" ,
4949 "includes" : PYTHON_INVALID_SPECIFIER_NO_NAME ,
5050 }
51- with pytest .raises (python_bindings .ApiException ):
52- python_bindings .RemotesPythonApi .create (body )
51+ # Pydantic addition to bindings in 3.70 prevent this test from working
52+ if has_pulp_plugin ("core" , max = "3.70" ):
53+ with pytest .raises (python_bindings .ApiException ):
54+ python_bindings .RemotesPythonApi .create (body )
5355
5456 # Test an include specifier with an invalid "version_specifier" field value.
5557 body ["includes" ] = PYTHON_INVALID_SPECIFIER_BAD_VERSION
@@ -59,8 +61,9 @@ def test_remote_invalid_project_specifier(python_bindings):
5961 # Test an exclude specifier without a "name" field.
6062 body .pop ("includes" )
6163 body ["excludes" ] = PYTHON_INVALID_SPECIFIER_NO_NAME
62- with pytest .raises (python_bindings .ApiException ):
63- python_bindings .RemotesPythonApi .create (body )
64+ if has_pulp_plugin ("core" , max = "3.70" ):
65+ with pytest .raises (python_bindings .ApiException ):
66+ python_bindings .RemotesPythonApi .create (body )
6467
6568 # Test an exclude specifier with an invalid "version_specifier" field value.
6669 body ["excludes" ] = PYTHON_INVALID_SPECIFIER_BAD_VERSION
@@ -95,14 +98,17 @@ def test_remote_version_specifier(python_bindings, add_to_cleanup):
9598
9699
97100@pytest .mark .parallel
98- def test_remote_update_invalid_project_specifier (python_bindings , python_remote_factory ):
101+ def test_remote_update_invalid_project_specifier (
102+ python_bindings , python_remote_factory , has_pulp_plugin
103+ ):
99104 """Test that updating a remote with an invalid project specifier fails non-destructively."""
100105 remote = python_remote_factory ()
101106
102107 # Test an include specifier without a "name" field.
103108 body = {"includes" : PYTHON_INVALID_SPECIFIER_NO_NAME }
104- with pytest .raises (python_bindings .ApiException ):
105- python_bindings .RemotesPythonApi .partial_update (remote .pulp_href , body )
109+ if has_pulp_plugin ("core" , max = "3.70" ):
110+ with pytest .raises (python_bindings .ApiException ):
111+ python_bindings .RemotesPythonApi .partial_update (remote .pulp_href , body )
106112
107113 # Test an include specifier with an invalid "version_specifier" field value.
108114 body = {"includes" : PYTHON_INVALID_SPECIFIER_BAD_VERSION }
@@ -111,8 +117,9 @@ def test_remote_update_invalid_project_specifier(python_bindings, python_remote_
111117
112118 # Test an exclude specifier without a "name" field.
113119 body = {"excludes" : PYTHON_INVALID_SPECIFIER_NO_NAME }
114- with pytest .raises (python_bindings .ApiException ):
115- python_bindings .RemotesPythonApi .partial_update (remote .pulp_href , body )
120+ if has_pulp_plugin ("core" , max = "3.70" ):
121+ with pytest .raises (python_bindings .ApiException ):
122+ python_bindings .RemotesPythonApi .partial_update (remote .pulp_href , body )
116123
117124 # Test an exclude specifier with an invalid "version_specifier" field value.
118125 body = {"excludes" : PYTHON_INVALID_SPECIFIER_BAD_VERSION }
0 commit comments