@@ -24,6 +24,7 @@ def test_bound_floating_ip_init(self, floating_ip_response):
2424
2525 assert bound_floating_ip .id == 4711
2626 assert bound_floating_ip .description == "Web Frontend"
27+ assert bound_floating_ip .name == "Web Frontend"
2728 assert bound_floating_ip .ip == "131.232.99.1"
2829 assert bound_floating_ip .type == "ipv4"
2930 assert bound_floating_ip .protection == {"delete" : False }
@@ -55,12 +56,13 @@ def test_get_actions(self, hetzner_client, bound_floating_ip, response_get_actio
5556
5657 def test_update (self , hetzner_client , bound_floating_ip , response_update_floating_ip ):
5758 hetzner_client .request .return_value = response_update_floating_ip
58- floating_ip = bound_floating_ip .update (description = "New description" )
59+ floating_ip = bound_floating_ip .update (description = "New description" , name = "New name" )
5960 hetzner_client .request .assert_called_with (url = "/floating_ips/14" , method = "PUT" ,
60- json = {"description" : "New description" })
61+ json = {"description" : "New description" , "name" : "New name" })
6162
6263 assert floating_ip .id == 4711
6364 assert floating_ip .description == "New description"
65+ assert floating_ip .name == "New name"
6466
6567 def test_delete (self , hetzner_client , bound_floating_ip , generic_action ):
6668 hetzner_client .request .return_value = generic_action
@@ -221,6 +223,32 @@ def test_create_with_server(self, floating_ips_client, server, floating_ip_creat
221223 assert bound_floating_ip .description == "Web Frontend"
222224 assert action .id == 13
223225
226+ @pytest .mark .parametrize ("server" , [Server (id = 1 ), BoundServer (mock .MagicMock (), dict (id = 1 ))])
227+ def test_create_with_name (self , floating_ips_client , server , floating_ip_create_response ):
228+ floating_ips_client ._client .request .return_value = floating_ip_create_response
229+ response = floating_ips_client .create (
230+ type = "ipv6" ,
231+ description = "Web Frontend" ,
232+ name = "Web Frontend"
233+ )
234+ floating_ips_client ._client .request .assert_called_with (
235+ url = "/floating_ips" ,
236+ method = "POST" ,
237+ json = {
238+ 'description' : "Web Frontend" ,
239+ 'type' : "ipv6" ,
240+ 'name' : "Web Frontend"
241+ }
242+ )
243+ bound_floating_ip = response .floating_ip
244+ action = response .action
245+
246+ assert bound_floating_ip ._client is floating_ips_client
247+ assert bound_floating_ip .id == 4711
248+ assert bound_floating_ip .description == "Web Frontend"
249+ assert bound_floating_ip .name == "Web Frontend"
250+ assert action .id == 13
251+
224252 @pytest .mark .parametrize ("floating_ip" , [FloatingIP (id = 1 ), BoundFloatingIP (mock .MagicMock (), dict (id = 1 ))])
225253 def test_get_actions (self , floating_ips_client , floating_ip , response_get_actions ):
226254 floating_ips_client ._client .request .return_value = response_get_actions
@@ -238,12 +266,13 @@ def test_get_actions(self, floating_ips_client, floating_ip, response_get_action
238266 @pytest .mark .parametrize ("floating_ip" , [FloatingIP (id = 1 ), BoundFloatingIP (mock .MagicMock (), dict (id = 1 ))])
239267 def test_update (self , floating_ips_client , floating_ip , response_update_floating_ip ):
240268 floating_ips_client ._client .request .return_value = response_update_floating_ip
241- floating_ip = floating_ips_client .update (floating_ip , description = "New description" )
269+ floating_ip = floating_ips_client .update (floating_ip , description = "New description" , name = "New name" )
242270 floating_ips_client ._client .request .assert_called_with (url = "/floating_ips/1" , method = "PUT" ,
243- json = {"description" : "New description" })
271+ json = {"description" : "New description" , "name" : "New name" })
244272
245273 assert floating_ip .id == 4711
246274 assert floating_ip .description == "New description"
275+ assert floating_ip .name == "New name"
247276
248277 @pytest .mark .parametrize ("floating_ip" , [FloatingIP (id = 1 ), BoundFloatingIP (mock .MagicMock (), dict (id = 1 ))])
249278 def test_change_protection (self , floating_ips_client , floating_ip , generic_action ):
0 commit comments