Activate and deactivate mocks
Before you begin
- Role
- Editor or higher.
- You need
- A mock
An Inactive mock never answers, but keeps everything else: its definition, its version history and the request logs it already has. Deactivate a mock to prepare it without affecting callers, to park one you may need again, or to swap between two mocks for the same request.
-
On the project’s Mocks tab, select the mock’s name.
-
In Status, choose Inactive, or Active to switch it back on.
-
Select Save mock.
Result
Section titled “Result”MockHub shows Mock saved, and the mock’s row on the Mocks tab shows its new status. The change applies from the next request to the project.
A request the mock used to answer now goes to whichever other active mock matches it. If none does, it is an unmatched request: answered with 404 in Mock only, or forwarded to the upstream in Proxy unmatched.
To list only the mocks that are switched off, select Filters on the Mocks tab and choose Inactive in Any status.
Activating a mock starts its unused count again, because an inactive mock cannot be called; deactivating one does not.
Several mocks at once
Section titled “Several mocks at once”-
On the project’s Mocks tab, tick the checkbox of each mock to change, or Select every mock on this page.
-
Select Activate or Deactivate.
To tick a run of mocks, tick the first, then hold Shift while you tick the last. Holding Shift on a ticked mock unticks the run instead.
MockHub shows how many mocks changed, such as 2 mocks activated. A mock that already had that status is left as it is.
The selection covers the page you see, and is cleared when you filter, sort or move to another page. To change every mock a filter finds, such as every inactive mock tagged orders, select Select all … matching after selecting the page; see Change every mock that matches.
When activating the selection would take the project or the workspace past its plan limit, none of the mocks is activated, the message names the limit, and the selection stays so you can narrow it.
A selection keeps the rows you chose it from: a change made elsewhere meanwhile shows Mocks changed elsewhere. instead of moving them, and Show changes clears the selection to show it. See Changes made elsewhere.
Mocks that start inactive
Section titled “Mocks that start inactive”A mock you create in the editor starts as Active unless you choose otherwise. Mocks generated with AI are always created Inactive, so that a person reviews each one before it answers anyone. Try it works on an inactive mock; see Test a mock before saving.
Plan limits count active mocks
Section titled “Plan limits count active mocks”The plan limits how many Active mocks a project and a workspace can have; Inactive mocks do not count. At the limit, activating one more is refused with a message naming the limit, and deactivating a mock makes room. The limits page lists the limits.
Limits
Section titled “Limits”- Save mock saves the whole mock as the editor shows it. When the mock holds a matcher the editor cannot show, the editor says “This mock has matchers this editor cannot show.” and names what saving would remove; switch such a mock in the configuration document instead, with its
status; see Edit a project’s configuration in the browser. - After you deactivate a mock, the first request it would still have matched can get a
404, even when another mock or the upstream would answer it; requests after that are answered as described above. - Deactivating a mock keeps its scenario’s state and its place in a response sequence: when the mock is active again, it carries on from there, unless seven days passed unused and it starts from
Startedor its first response. Reset all on Scenarios resets them while the mock is inactive too. - Versions do not record the status, so a save that changes only the status adds no entry to the mock’s version history, and restoring one leaves the mock active or inactive as it is.
- There is no schedule: a mock does not switch on or off at a set time.