Exemplo n.º 1
0
 def test_branch_with_name_stable(self):
     version = new(Version,
                   identifier=u'origin/stable',
                   slug=STABLE,
                   verbose_name=u'stable',
                   type=BRANCH)
     self.assertEqual(version.commit_name, u'stable')
Exemplo n.º 2
0
 def test_tag_name(self):
     version = new(Version,
                   identifier=u'10f1b29a2bd2',
                   slug=u'release-2.5.0',
                   verbose_name=u'release-2.5.0',
                   type=TAG)
     self.assertEqual(version.commit_name, u'release-2.5.0')
Exemplo n.º 3
0
 def test_branch_name(self):
     version = new(Version,
                   identifier=u'release-2.5.x',
                   slug=u'release-2.5.x',
                   verbose_name=u'release-2.5.x',
                   type=BRANCH)
     self.assertEqual(version.commit_name, 'release-2.5.x')
 def test_hg_latest_branch(self):
     hg_project = get(Project, repo_type=REPO_TYPE_HG)
     version = new(
         Version, identifier='default', slug=LATEST,
         verbose_name=LATEST, type=BRANCH, project=hg_project,
     )
     self.assertEqual(version.commit_name, 'default')
 def test_branch_name(self):
     version = new(
         Version, identifier='release-2.5.x',
         slug='release-2.5.x', verbose_name='release-2.5.x',
         type=BRANCH,
     )
     self.assertEqual(version.commit_name, 'release-2.5.x')
    def count_queries_for_model(self, app, model):
        try:
            model_instance = new(model, print_errors=False)
        except Exception as e:
            self.report.add_error('- Could not prepare %s: %s' %
                                  (get_unique_model_name(model), str(e)))
            return

        db.reset_queries()
        try:
            model_instance.save()
        except Exception as e:
            self.report.add_error('- Could not insert %s: %s' %
                                  (get_unique_model_name(model), str(e)))
            return
        queries_insert = len(connection.queries)

        db.reset_queries()
        try:
            model_instance.save()
        except Exception as e:
            self.report.add_error('- Could not update %s: %s' %
                                  (get_unique_model_name(model), str(e)))
            return
        queries_update = len(connection.queries)

        self.report.add_record(app, model, queries_insert, queries_update)
Exemplo n.º 7
0
 def test_stable_version_tag(self):
     version = new(Version,
                   identifier=u'3d92b728b7d7b842259ac2020c2fa389f13aff0d',
                   slug=STABLE,
                   verbose_name=STABLE,
                   type=TAG)
     self.assertEqual(version.commit_name,
                      u'3d92b728b7d7b842259ac2020c2fa389f13aff0d')
 def test_git_latest_branch(self):
     git_project = get(Project, repo_type=REPO_TYPE_GIT)
     version = new(
         Version, project=git_project,
         identifier='origin/master', slug=LATEST,
         verbose_name=LATEST, type=BRANCH,
     )
     self.assertEqual(version.commit_name, 'master')
 def test_branch_name_made_friendly_when_sha(self):
     commit_hash = '3d92b728b7d7b842259ac2020c2fa389f13aff0d'
     version = new(
         Version, identifier=commit_hash,
         slug=STABLE, verbose_name=STABLE, type=TAG,
     )
     # we shorten commit hashes to keep things readable
     self.assertEqual(version.identifier_friendly, '3d92b728')
Exemplo n.º 10
0
 def test_branch_name_made_friendly_when_sha(self):
     commit_hash = u'3d92b728b7d7b842259ac2020c2fa389f13aff0d'
     version = new(Version,
                   identifier=commit_hash,
                   slug=STABLE,
                   verbose_name=STABLE,
                   type=TAG)
     # we shorten commit hashes to keep things readable
     self.assertEqual(version.identifier_friendly, '3d92b728')
Exemplo n.º 11
0
 def test_hg_latest_branch(self):
     hg_project = get(Project, repo_type=REPO_TYPE_HG)
     version = new(Version,
                   identifier=u'default',
                   slug=LATEST,
                   verbose_name=LATEST,
                   type=BRANCH,
                   project=hg_project)
     self.assertEqual(version.commit_name, u'default')
Exemplo n.º 12
0
 def test_git_latest_branch(self):
     git_project = get(Project, repo_type=REPO_TYPE_GIT)
     version = new(Version,
                   project=git_project,
                   identifier=u'origin/master',
                   slug=LATEST,
                   verbose_name=LATEST,
                   type=BRANCH)
     self.assertEqual(version.commit_name, u'master')
Exemplo n.º 13
0
 def test_external_version(self):
     identifier = 'ec26de721c3235aad62de7213c562f8c821'
     version = new(
         Version,
         identifier=identifier,
         slug='11',
         verbose_name='11',
         type=EXTERNAL,
     )
     self.assertEqual(version.commit_name, identifier)
Exemplo n.º 14
0
    def setUp(self):
        self.user = new(User, username='******')
        self.user.set_password('test')
        self.user.save()

        self.project = get(Project, slug='my-mainproject')
        self.subproject = get(Project, slug='my-subproject')
        self.project.add_subproject(self.subproject)

        self.client.login(username='******', password='******')
Exemplo n.º 15
0
    def setUp(self):
        self.user = new(User, username='******')
        self.user.set_password('test')
        self.user.save()

        self.project = get(Project, slug='my-mainproject')
        self.subproject = get(Project, slug='my-subproject')
        self.project.add_subproject(self.subproject)

        self.client.login(username='******', password='******')
 def test_stable_version_tag(self):
     version = new(
         Version,
         identifier='3d92b728b7d7b842259ac2020c2fa389f13aff0d',
         slug=STABLE, verbose_name=STABLE, type=TAG,
     )
     self.assertEqual(
         version.commit_name,
         '3d92b728b7d7b842259ac2020c2fa389f13aff0d',
     )
    def count_queries_for_model(self, app, model):
        try:
            model_instance = new(model, print_errors=False)
        except Exception as e:
            self.report.add_error('- Could not prepare %s: %s' % (get_unique_model_name(model), str(e)))
            return

        db.reset_queries()
        try:
            model_instance.save()
        except Exception as e:
            self.report.add_error('- Could not insert %s: %s' % (get_unique_model_name(model), str(e)))
            return
        queries_insert = len(connection.queries)

        db.reset_queries()
        try:
            model_instance.save()
        except Exception as e:
            self.report.add_error('- Could not update %s: %s' % (get_unique_model_name(model), str(e)))
            return
        queries_update = len(connection.queries)

        self.report.add_record(app, model, queries_insert, queries_update)
Exemplo n.º 18
0
 def setUp(self):
     self.user = new(User, username='******')
     self.user.set_password('test')
     self.user.save()
     self.client.login(username='******', password='******')
Exemplo n.º 19
0
def create_user(username, password):
    user = new(User, username=username)
    user.set_password(password)
    user.save()
    return user
 def setUp(self):
     self.user = new(User, username="******")
     self.user.set_password("test")
     self.user.save()
     self.client.login(username="******", password="******")
Exemplo n.º 21
0
def create_user(username, password, **kwargs):
    user = new(User, username=username, **kwargs)
    user.set_password(password)
    user.save()
    return user
 def test_branch_name_unicode_non_ascii(self):
     unicode_name = b'abc_\xd1\x84_\xe2\x99\x98'.decode('utf-8')
     version = new(Version, identifier=unicode_name, type=BRANCH)
     self.assertEqual(version.identifier_friendly, unicode_name)
Exemplo n.º 23
0
 def setUp(self):
     self.user = new(User, username='******')
     self.user.set_password('test')
     self.user.save()
     self.client.login(username='******', password='******')
     self.project = get(Project, slug='pip', users=[self.user])
Exemplo n.º 24
0
 def test_branch_name_unicode_non_ascii(self):
     unicode_name = b'abc_\xd1\x84_\xe2\x99\x98'.decode('utf-8')
     version = new(Version, identifier=unicode_name, type=BRANCH)
     self.assertEqual(version.identifier_friendly, unicode_name)
 def test_tag_name(self):
     version = new(Version, identifier=u'10f1b29a2bd2', slug=u'release-2.5.0',
                   verbose_name=u'release-2.5.0', type=TAG)
     self.assertEqual(version.commit_name, u'release-2.5.0')
 def setUp(self):
     self.user = new(User, username='******')
     self.user.set_password('test')
     self.user.save()
     self.client.login(username='******', password='******')
 def test_branch_with_name_stable(self):
     version = new(Version, identifier=u'origin/stable', slug=STABLE,
                   verbose_name=u'stable', type=BRANCH)
     self.assertEqual(version.commit_name, u'stable')