def test_git_no_local(self):
        with SettingsOverride(DEBUG=False):
            client = SourceClient('/some/local/url', 'git')
            self.assertRaises(ClientError, _fetch_git, client)

            client = SourceClient('/etc', 'git')
            self.assertRaises(ClientError, _fetch_git, client)
 def test_github_client_https(self):
     client = SourceClient('https://[email protected]/mrj0/jep.git')
     _fetch_github(client, session=FakeRequestsSession(GITHUB_JEP_REPO))
     self.assertEqual('mrj0', client.discovered['author'])
     self.assertEqual('http://jepp.sourceforge.net/',
                      client.discovered['url'])
     self.assertEqual('Embed Python in Java',
                      client.discovered['description'])
    def test_git_fetch_tcp(self, mock):
        def make_test_files(path, local):
            touch_test_files(local.path, ['test_file', '.git/somefile'])

        mock.side_effect = make_test_files

        client = SourceClient('git://github.com/mrj0/jep.git', 'git')
        _fetch_git(client)
        self.assertTrue('test_file' in client.files)
        self.assertFalse('.git/somefile' in client.files)
 def test_bitbucket(self):
     client = SourceClient('ssh://[email protected]/andrewgodwin/south',
                           'hg')
     _fetch_bitbucket(client,
                      session=FakeRequestsSession(BITBUCKET_SOUTH_REPO))
     self.assertEqual('andrewgodwin', client.discovered['author'])
     self.assertEqual('http://south.aeracode.org/',
                      client.discovered['url'])
     self.assertEqual('Migrations for Django',
                      client.discovered['description'])
    def test_mercurial_fetch(self, mock):
        def make_test_files(*args, **kwargs):
            touch_test_files(kwargs['dest'], ['test_file', '.hg/somefile'])

        mock.side_effect = make_test_files

        client = SourceClient('ssh://[email protected]/andrewgodwin/south',
                              'hg')
        _fetch_mercurial(client)
        self.assertTrue('test_file' in client.files)
        self.assertFalse('.hg/somefile' in client.files)