Beispiel #1
0
    def test_update_state_no_change(self, mocker, check, state):
        client = mocker.Mock()

        result = user.update_state(client, '/path', state, state, check)

        assert result is False
        client.put.assert_not_called()
        client.delete.assert_not_called()
Beispiel #2
0
    def test_enable_user_check_mode(self, mocker):
        client = mocker.Mock()

        # Go from disabled == True to disabled == False
        result = user.update_state(client, '/path', True, False, True)

        assert result is True
        client.put.assert_not_called()
        client.delete.assert_not_called()
Beispiel #3
0
    def test_enable_user(self, mocker):
        client = mocker.Mock()
        client.put.return_value = http.Response(201, '')

        # Go from disabled == True to disabled == False
        result = user.update_state(client, '/path', True, False, False)

        assert result is True
        client.put.assert_called_once_with('/path/reinstate', None)
        client.delete.assert_not_called()