def test_POST_update_nodes_ignores_unknown_nodes(self): tag = factory.make_tag() self.become_admin() unknown_add_system_id = generate_node_system_id() unknown_remove_system_id = generate_node_system_id() self.assertItemsEqual([], tag.node_set.all()) response = self.client.post( self.get_tag_uri(tag), { 'op': 'update_nodes', 'add': [unknown_add_system_id], 'remove': [unknown_remove_system_id], }) self.assertEqual(httplib.OK, response.status_code) parsed_result = json.loads(response.content) self.assertItemsEqual([], tag.node_set.all()) self.assertEqual({'added': 0, 'removed': 0}, parsed_result)
def test_POST_update_nodes_ignores_unknown_nodes(self): tag = factory.make_Tag() self.become_admin() unknown_add_system_id = generate_node_system_id() unknown_remove_system_id = generate_node_system_id() self.assertItemsEqual([], tag.node_set.all()) response = self.client.post( self.get_tag_uri(tag), { "op": "update_nodes", "add": [unknown_add_system_id], "remove": [unknown_remove_system_id], }, ) self.assertEqual(http.client.OK, response.status_code) parsed_result = json.loads( response.content.decode(settings.DEFAULT_CHARSET)) self.assertItemsEqual([], tag.node_set.all()) self.assertEqual({"added": 0, "removed": 0}, parsed_result)