def test_restore_snapshot(self, client_factory_mock):
        cmd_mock = _get_test_cmd()
        cli_ctx_mock = mock.MagicMock()
        cli_ctx_mock.data = {'subscription_id': 'sub1'}
        cmd_mock.cli_ctx = cli_ctx_mock

        client = mock.MagicMock()
        client.web_apps.restore_snapshot_slot = mock.MagicMock()
        client.web_apps.restore_snapshot = mock.MagicMock()
        client_factory_mock.return_value = client

        SnapshotRecoverySource, SnapshotRestoreRequest = \
            cmd_mock.get_models('SnapshotRecoverySource', 'SnapshotRestoreRequest')
        source = SnapshotRecoverySource(
            id=
            '/subscriptions/sub1/resourceGroups/src_rg/providers/Microsoft.Web/sites/src_web/slots/src_slot'
        )
        request = SnapshotRestoreRequest(
            overwrite=False,
            snapshot_time='2018-12-07T02:01:31.4708832Z',
            recovery_source=source,
            recover_configuration=False)
        overwrite_request = SnapshotRestoreRequest(
            overwrite=True,
            snapshot_time='2018-12-07T02:01:31.4708832Z',
            recover_configuration=True)

        # action
        restore_snapshot(cmd_mock,
                         'rg',
                         'web1',
                         '2018-12-07T02:01:31.4708832Z',
                         slot='slot1',
                         restore_content_only=True,
                         source_resource_group='src_rg',
                         source_name='src_web',
                         source_slot='src_slot')
        restore_snapshot(cmd_mock,
                         'rg',
                         'web1',
                         '2018-12-07T02:01:31.4708832Z',
                         restore_content_only=False)

        # assert
        client.web_apps.restore_snapshot_slot.assert_called_with(
            'rg', 'web1', request, 'slot1')
        client.web_apps.restore_snapshot.assert_called_with(
            'rg', 'web1', overwrite_request)
    def test_restore_snapshot(self, client_factory_mock):
        cmd_mock = mock.MagicMock()
        cli_ctx_mock = mock.MagicMock()
        cli_ctx_mock.data = {'subscription_id': 'sub1'}
        cmd_mock.cli_ctx = cli_ctx_mock

        client = mock.MagicMock()
        client.web_apps.restore_snapshot_slot = mock.MagicMock()
        client.web_apps.restore_snapshot = mock.MagicMock()
        client_factory_mock.return_value = client

        source = SnapshotRecoverySource(id='/subscriptions/sub1/resourceGroups/src_rg/providers/Microsoft.Web/sites/src_web/slots/src_slot')
        request = SnapshotRestoreRequest(overwrite=False, snapshot_time='2018-12-07T02:01:31.4708832Z',
                                         recovery_source=source, recover_configuration=False)
        overwrite_request = SnapshotRestoreRequest(overwrite=True, snapshot_time='2018-12-07T02:01:31.4708832Z', recover_configuration=True)

        # action
        restore_snapshot(cmd_mock, 'rg', 'web1', '2018-12-07T02:01:31.4708832Z', slot='slot1', restore_content_only=True,
                         source_resource_group='src_rg', source_name='src_web', source_slot='src_slot')
        restore_snapshot(cmd_mock, 'rg', 'web1', '2018-12-07T02:01:31.4708832Z', restore_content_only=False)

        # assert
        client.web_apps.restore_snapshot_slot.assert_called_with('rg', 'web1', request, 'slot1')
        client.web_apps.restore_snapshot.assert_called_with('rg', 'web1', overwrite_request)