Пример #1
0
def test_remove_content(monkeypatch, mock_app):
    with_mock_app(monkeypatch, mock_app)
    name = 'my-subscription'
    argv = ['del', name, '--episodes']
    main.main(argv=argv)
    mock_app.remove_subscription.assert_called_once_with(name,
                                                         delete_content=True)
Пример #2
0
def test_add(monkeypatch, mock_app):
    with_mock_app(monkeypatch, mock_app)
    url = 'http://example.com'
    name = 'new-subscription'
    content_dir = 'my-content-dir'
    max_epis = 10
    argv = [
        'add', url, '--name', name, '--directory', content_dir,
        '--max-episodes',
        str(max_epis)
    ]
    main.main(argv=argv)
    mock_app.add_subscription.assert_called_once_with(url,
                                                      name=name,
                                                      content_dir=content_dir,
                                                      filename_template=None,
                                                      max_episodes=max_epis)
    assert mock_app.update.called
Пример #3
0
def test_update_many(monkeypatch, mock_app):
    with_mock_app(monkeypatch, mock_app)
    argv = ['update', 'subscription-1', 'subscription-2']
    main.main(argv=argv)
    assert mock_app.update.call_count == 1
Пример #4
0
def test_forced_update(monkeypatch, mock_app):
    with_mock_app(monkeypatch, mock_app)
    argv = ['update', '--force']
    main.main(argv=argv)
    assert mock_app.update.call_count == 1