from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import pytest

from twine import cli


def test_catches_enoent():
    with pytest.raises(SystemExit):
        cli.dispatch(["non-existant-command"])

from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import pretend
import pytest

from twine import cli
import twine.commands.upload


def test_dispatch_to_subcommand(monkeypatch):
    replaced_main = pretend.call_recorder(lambda args: None)
    monkeypatch.setattr(twine.commands.upload, "main", replaced_main)

    cli.dispatch(["upload", "path/to/file"])

    assert replaced_main.calls == [pretend.call(["path/to/file"])]


def test_catches_enoent():
    with pytest.raises(SystemExit):
        cli.dispatch(["non-existant-command"])

Add test for upload functionality
Add test for upload functionality

  from __future__ import absolute_import, division, print_function
  from __future__ import unicode_literals
  
+ import pretend
  import pytest
  
  from twine import cli
+ import twine.commands.upload
+ 
+ 
+ def test_dispatch_to_subcommand(monkeypatch):
+     replaced_main = pretend.call_recorder(lambda args: None)
+     monkeypatch.setattr(twine.commands.upload, "main", replaced_main)
+ 
+     cli.dispatch(["upload", "path/to/file"])
+ 
+     assert replaced_main.calls == [pretend.call(["path/to/file"])]
  
  
  def test_catches_enoent():
      with pytest.raises(SystemExit):
          cli.dispatch(["non-existant-command"])
  
Add test for upload functionality
## Code Before:
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import pytest

from twine import cli


def test_catches_enoent():
    with pytest.raises(SystemExit):
        cli.dispatch(["non-existant-command"])

## Instruction:
Add test for upload functionality
## Code After:
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import pretend
import pytest

from twine import cli
import twine.commands.upload


def test_dispatch_to_subcommand(monkeypatch):
    replaced_main = pretend.call_recorder(lambda args: None)
    monkeypatch.setattr(twine.commands.upload, "main", replaced_main)

    cli.dispatch(["upload", "path/to/file"])

    assert replaced_main.calls == [pretend.call(["path/to/file"])]


def test_catches_enoent():
    with pytest.raises(SystemExit):
        cli.dispatch(["non-existant-command"])
