~rvb/maas/maas.serializable

« back to all changes in this revision

Viewing changes to src/maasserver/api/tests/test_ipaddresses.py

[r=rvb][bug=1383231][author=gmb] StaticIPAddressManager._attempt_allocation() now gives a useful error message to the StaticIPAddressUnavailable that it raises when someone is already using a static IP.

Previously, API users were confronted with a blank line when trying to request an in-use IP  address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
        self.assertEqual(httplib.OK, response.status_code, response.content)
131
131
        # Do same request again and check it is rejected.
132
132
        response = self.post_reservation_request(net, ip_in_network)
133
 
        self.assertEqual(
134
 
            httplib.NOT_FOUND, response.status_code, response.content)
 
133
        self.expectThat(response.status_code, Equals(httplib.NOT_FOUND))
 
134
        self.expectThat(
 
135
            response.content, Equals(
 
136
                "The IP address %s is already in use." % ip_in_network))
135
137
 
136
138
    def test_POST_reserve_requested_address_detects_out_of_range_addr(self):
137
139
        interface = self.make_interface()