-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reproduces the issue described in #97, when saving an unpopulated object apparently triggers population before sending the PUT request. Fix coming soon.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
test/fixtures/nodebalancers_123456_configs_65432_nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"status": "Unknown", | ||
"nodebalancer_id": 123456, | ||
"weight": 50, | ||
"address": "192.168.12.34:999", | ||
"mode": "accept", | ||
"label": "test", | ||
"config_id": 65432, | ||
"id": 24680 | ||
} | ||
], | ||
"results": 1, | ||
"page": 1, | ||
"pages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from datetime import datetime | ||
|
||
from test.base import ClientBaseCase | ||
from linode.objects.base import MappedObject | ||
|
||
from linode.objects import NodeBalancerNode | ||
|
||
|
||
class NodeBalancerConfigTest(ClientBaseCase): | ||
""" | ||
Tests methods of the NodeBalancerNode class | ||
""" | ||
def test_update_not_populated_saves(self): | ||
""" | ||
Tests that updating an unpopulated object sends the correct request | ||
""" | ||
node = NodeBalancerNode(self.client, 24680, 65432, 123456) | ||
|
||
with self.mock_put('/nodebalancers/123456/configs/65432/nodes/24680') as m: | ||
node.weight = 100 | ||
self.assertEqual(node._populated, False) | ||
node.save() | ||
|
||
self.assertEqual(m.call_data['weight'], 100) | ||
|
||
|