+ # get the instance status
+ res = client.get(ADM_CTRL_INSTANCE_STATUS)
+ assert res.status_code == 200
+ assert res.get_data(as_text=True) == expected
+
+ # try a status get but we didn't get any ACKs yet to test NOT IN EFFECT
+ time.sleep(1) # wait for the rmr thread
+ get_instance_good("NOT IN EFFECT")
+
+ # now pretend we did get a good ACK
+ monkeypatch.setattr("rmr.helpers.rmr_rcvall_msgs", _fake_dequeue)
+ time.sleep(1) # wait for the rmr thread
+ get_instance_good("IN EFFECT")
+
+ # cant delete type until there are no instances
+ res = client.delete(ADM_CTRL_TYPE)
+ assert res.status_code == 400
+
+ # delete it
+ res = client.delete(ADM_CTRL_INSTANCE)
+ assert res.status_code == 202
+ res = client.delete(ADM_CTRL_INSTANCE) # should be able to do multiple deletes
+ assert res.status_code == 202
+
+ # status after a delete, but there are no messages yet, should still return
+ monkeypatch.setattr("rmr.helpers.rmr_rcvall_msgs", _fake_dequeue)
+ time.sleep(1) # wait for the rmr thread
+ get_instance_good("IN EFFECT")
+
+ # now pretend we deleted successfully
+ monkeypatch.setattr("rmr.helpers.rmr_rcvall_msgs", _fake_dequeue_deleted)
+ time.sleep(1) # wait for the rmr thread
+ res = client.get(ADM_CTRL_INSTANCE_STATUS) # cant get status
+ assert res.status_code == 404
+ res = client.get(ADM_CTRL_INSTANCE) # cant get instance
+ assert res.status_code == 404
+
+ # list still 200 but no instance
+ res = client.get(ADM_CTRL_POLICIES)