def test_should_run_all_tasks_until_finished(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv' }) mock_reactor = mock() mock_task_1 = mock() mock_task_2 = mock() when(pyb_init.reactor).for_local_initialization().thenReturn( mock_reactor) when(mock_reactor).get_tasks().thenReturn([mock_task_1, mock_task_2]) entry_point() verify(mock_task_1).execute() verify(mock_task_2).execute()
def test_should_invoke_docopt_with_version_and_docstring(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv'}) entry_point() verify(pyb_init).docopt(doc=pyb_init.__doc__, version='${version}')
def test_should_run_local_initialization_when_argument_is_given(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv'}) entry_point() verify(pyb_init.reactor).for_local_initialization()
def test_should_configure_virtualenv_name(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'foobar'}) entry_point() self.assertEqual(configuration['virtualenv_name'], 'foobar')
def test_should_not_configure_system_site_packages_when_option_is_not_provided(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '-s': False, '--virtualenv': 'venv'}) entry_point() self.assertFalse(configuration['virtualenv_use_system_site_packages'])
def test_should_run_svn_checkout_when_argument_is_given(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': False, 'git': False, 'github': False, 'svn': True, '<svn_url>': 'http://code/foo/bar', '--virtualenv': 'virtualenv'}) entry_point() verify(pyb_init.reactor).for_svn_checkout( svn_url='http://code/foo/bar')
def test_should_run_github_initialization_when_argument_is_given(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': False, 'git': False, 'github': True, 'svn': False, '<user>': 'coder1234', '<project>': 'committer', '--virtualenv': 'virtualenv'}) entry_point() verify(pyb_init.reactor).for_github_clone( user='******', project='committer')
def test_should_eat_exceptions_and_output_error_message_instead(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'foobar'}) when(pyb_init.reactor).for_local_initialization().thenRaise( RuntimeError('too fat to fly')) when(pyb_init.logger).error(any_value()).thenReturn(None) entry_point() verify(pyb_init.logger).error('too fat to fly')
def test_should_run_local_initialization_when_argument_is_given(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv' }) entry_point() verify(pyb_init.reactor).for_local_initialization()
def test_should_invoke_docopt_with_version_and_docstring(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv' }) entry_point() verify(pyb_init).docopt(doc=pyb_init.__doc__, version='${version}')
def test_should_configure_virtualenv_name(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'foobar' }) entry_point() self.assertEqual(configuration['virtualenv_name'], 'foobar')
def test_should_run_all_tasks_until_finished(self): when( pyb_init).docopt( doc=any_value( ), version=any_value()).thenReturn({'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'virtualenv'}) mock_reactor = mock() mock_task_1 = mock() mock_task_2 = mock() when(pyb_init.reactor).for_local_initialization().thenReturn( mock_reactor) when(mock_reactor).get_tasks().thenReturn([mock_task_1, mock_task_2]) entry_point() verify(mock_task_1).execute() verify(mock_task_2).execute()
def test_should_run_svn_checkout_when_argument_is_given(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': False, 'git': False, 'github': False, 'svn': True, '<svn_url>': 'http://code/foo/bar', '--virtualenv': 'virtualenv' }) entry_point() verify( pyb_init.reactor).for_svn_checkout(svn_url='http://code/foo/bar')
def test_should_eat_exceptions_and_output_error_message_instead(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '--virtualenv': 'foobar' }) when(pyb_init.reactor).for_local_initialization().thenRaise( RuntimeError('too fat to fly')) when(pyb_init.logger).error(any_value()).thenReturn(None) entry_point() verify(pyb_init.logger).error('too fat to fly')
def test_should_not_configure_system_site_packages_when_option_is_not_provided( self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': True, 'github': False, 'git': False, 'svn': False, '-s': False, '--virtualenv': 'venv' }) entry_point() self.assertFalse(configuration['virtualenv_use_system_site_packages'])
def test_should_run_github_initialization_when_argument_is_given(self): when(pyb_init).docopt(doc=any_value(), version=any_value()).thenReturn({ 'local': False, 'git': False, 'github': True, 'svn': False, '<user>': 'coder1234', '<project>': 'committer', '--virtualenv': 'virtualenv' }) entry_point() verify(pyb_init.reactor).for_github_clone(user='******', project='committer')