Exemple #1
0
    def test_delete_integrators(self):
        ''' delete integrator: Mike <*****@*****.**> '''

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        I: Mike <*****@*****.**>
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        self.assertEqual(['*****@*****.**', '*****@*****.**'], [
            i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b',
                role='INTEGRATOR').user_set.all().order_by('email')
        ])
    def test_update_GitTree(self):
        '''Change gitree's subdomain from "System / Alarm" to "System / Call" '''
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/alsa-scenario-scn-data-0-base
        D: System / Alarm
        ''')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System

        T: adaptation/alsa-scenario-scn-data-0-base
        D: System / Call
        ''')
        self.assertEqual(
            [],
            [g.gitpath for g in GitTree.objects.filter(subdomain__name='Alarm')])
        self.assertEqual(
            ['adaptation/alsa-scenario-scn-data-0-base'],
            [g.gitpath for g in GitTree.objects.filter(subdomain__name='Call')])
Exemple #3
0
    def test_update_GitTree(self):
        '''Change gitree's subdomain from "System / Alarm" to "System / Call" '''
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/alsa-scenario-scn-data-0-base
        D: System / Alarm
        ''')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System

        T: adaptation/alsa-scenario-scn-data-0-base
        D: System / Call
        ''')
        self.assertEqual([], [
            g.gitpath for g in GitTree.objects.filter(subdomain__name='Alarm')
        ])
        self.assertEqual(['adaptation/alsa-scenario-scn-data-0-base'], [
            g.gitpath for g in GitTree.objects.filter(subdomain__name='Call')
        ])
Exemple #4
0
    def test_add_same_user_in_different_gittree(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        D: Appframework

        D: Appframework / Gallery
        N: Appframework

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>

        T: c/d
        D: Appframework / Gallery
        M: Mike <*****@*****.**>
        ''')

        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role='ARCHITECT').user_set.all()
        ])
        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='c/d',
                                             role='MAINTAINER').user_set.all()
        ])
        self.assertEqual(['*****@*****.**'], [u.email for u in User.objects.all()])
Exemple #5
0
    def test_update_architectures(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>
        ''')
        self.assertEqual(['*****@*****.**'], [u.email for u in User.objects.all()])

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike Frédéric <*****@*****.**>
        ''')

        self.assertEqual(['Frédéric'], [
            i.last_name.encode('utf8')
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role='ARCHITECT').user_set.all()
        ])
        self.assertEqual(['*****@*****.**'], [u.email for u in User.objects.all()])
Exemple #6
0
    def test_update_architectures(self):
        from_string('''
        D: System

        D: System / Clock
        N: System
        A: Mike <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])

        from_string('''
        D: System

        D: System / Clock
        N: System
        A: Mike Frédéric <*****@*****.**>
        ''')

        self.assertEqual(
            ['Frédéric'],
            [i.last_name.encode('utf8') for i in SubDomainRole.objects.get(
                subdomain__name='Clock', role='ARCHITECT').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])
    def test_add_three_gittrees(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System

        T: adaptation/face-engine
        D: System / Alarm

        T: adaptation/alsa-scen
        D: System / Alarm

        T: apps/core/preloaded/email
        D: System / Call
        ''')
        self.assertEqual([
            'adaptation/alsa-scen',
            'adaptation/face-engine',
            'apps/core/preloaded/email'
        ], [
            g.gitpath for g in GitTree.objects.all().order_by('gitpath')
        ])
Exemple #8
0
    def test_delete_all_roles(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        R: Mike <*****@*****.**>
        A: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        M: <*****@*****.**>
        ''')
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        ''')
        for role in ROLES:
            self.assertEqual([], [
                r.role
                for r in GitTreeRole.objects.filter(gittree__gitpath='a/b',
                                                    role=role)
            ])
Exemple #9
0
    def test_update_subdomain(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System
        ''')
        from_string('''
        D: System

        D: App

        D: App / Alarm
        N: App
        ''')

        self.assertEqual(
            'Alarm',
            SubDomain.objects.filter(
                domain__name='App').exclude(
                    name='Uncategorized')[0].name
        )
        self.assertFalse(
            SubDomain.objects.filter(
                domain__name='System').exclude(
                    name='Uncategorized')
        )
    def test_add_gittree_dont_delete_others(self):
        from_string('''
         D: System

         D: System / Alarm
         N: System

         T: dapt/alsa
         D: System / Alarm
         ''')
        from_string('''
         D: System

         D: System / Alarm
         N: System

         T: dapt/alsa
         D: System / Alarm

         T: ton/face
         D: System / Alarm
         ''')
        self.assertEqual(
            ['dapt/alsa', 'ton/face'],
            [g.gitpath for g in GitTree.objects.filter(
                subdomain__name='Alarm').order_by('gitpath')])
Exemple #11
0
    def test_add_same_user_in_different_subdomain(self):
        from_string('''
        D: System

        D: System / Clock
        N: System
        A: Mike <*****@*****.**>

        D: Appframework

        D: Appframework / Gallery
        N: Appframework
        M: Mike <*****@*****.**>
        ''')

        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in SubDomainRole.objects.get(
                subdomain__name='Clock', role='ARCHITECT').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in SubDomainRole.objects.get(
                subdomain__name='Gallery', role='MAINTAINER').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])
Exemple #12
0
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join([domains_str, os.linesep, os.linesep,
                               gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemple #13
0
    def test_delete_integrators(self):
        ''' delete integrator: Mike <*****@*****.**> '''

        from_string('''
        D: System

        D: System / Clock
        N: System
        I: Mike <*****@*****.**>
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        from_string('''
        D: System

        D: System / Clock
        N: System
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**', '*****@*****.**'],
            [i.email for i in SubDomainRole.objects.get(
                subdomain__name='Clock',
                role='INTEGRATOR').user_set.all().order_by('email')])
    def test_delete_all_roles(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        R: Mike <*****@*****.**>
        A: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        M: <*****@*****.**>
        ''')
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        ''')
        for role in ROLES:
            self.assertEqual(
                [],
                [r.role for r in GitTreeRole.objects.filter(
                    gittree__gitpath='a/b',
                    role=role)])
    def test_delete_integrators(self):
        ''' delete integrator: Mike <*****@*****.**> '''

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        I: Mike <*****@*****.**>
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        I: Lucy David <*****@*****.**>
        I: <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**', '*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b',
                role='INTEGRATOR').user_set.all().order_by('email')])
    def test_delete_all_license_for_gittree(self):
        License.objects.bulk_create([
            License(shortname='BSD-2-Clause'),
            License(shortname='CC-BY-NC-2.5'),
            License(shortname='Epinions')
        ])
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/face-engine
        D: System / Alarm
        L: BSD-2-Clause
        L: CC-BY-NC-2.5
        L: Epinions
        ''')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/face-engine
        D: System / Alarm
        ''')
        self.assertEqual(
            [],
            [l.shortname for l in License.objects.filter(
                gittree__gitpath='adaptation/face-engine')])
    def test_update_architectures(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike Frédéric <*****@*****.**>
        ''')

        self.assertEqual(
            ['Frédéric'],
            [i.last_name.encode('utf8') for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role='ARCHITECT').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])
Exemple #18
0
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join(
                [domains_str, os.linesep, os.linesep, gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemple #19
0
    def test_add_gittree_dont_delete_others(self):
        from_string('''
         D: System

         D: System / Alarm
         N: System

         T: dapt/alsa
         D: System / Alarm
         ''')
        from_string('''
         D: System

         D: System / Alarm
         N: System

         T: dapt/alsa
         D: System / Alarm

         T: ton/face
         D: System / Alarm
         ''')
        self.assertEqual(['dapt/alsa', 'ton/face'], [
            g.gitpath for g in GitTree.objects.filter(
                subdomain__name='Alarm').order_by('gitpath')
        ])
    def test_add_same_user_in_different_gittree(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        D: Appframework

        D: Appframework / Gallery
        N: Appframework

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>

        T: c/d
        D: Appframework / Gallery
        M: Mike <*****@*****.**>
        ''')

        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role='ARCHITECT').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='c/d', role='MAINTAINER').user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [u.email for u in User.objects.all()])
Exemple #21
0
    def test_delete_all_license_for_gittree(self):
        License.objects.bulk_create([
            License(shortname='BSD-2-Clause'),
            License(shortname='CC-BY-NC-2.5'),
            License(shortname='Epinions')
        ])
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/face-engine
        D: System / Alarm
        L: BSD-2-Clause
        L: CC-BY-NC-2.5
        L: Epinions
        ''')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: adaptation/face-engine
        D: System / Alarm
        ''')
        self.assertEqual([], [
            l.shortname for l in License.objects.filter(
                gittree__gitpath='adaptation/face-engine')
        ])
 def test_add_one_GitTree_without_domain(self):
     from_string('''
     T: dapt/alsa
     ''')
     self.assertEqual(
         ['dapt/alsa'],
         [g.gitpath for g in GitTree.objects.filter(
             subdomain__name='Uncategorized',
             subdomain__domain__name='Uncategorized')])
Exemple #23
0
    def test_add_domain_dont_delete_others():
        from_string("D: Another")

        from_string('''
        D: Another

        D: System
        ''')
        assert Domain.objects.get(name="Another")
Exemple #24
0
 def test_add_one_GitTree_without_domain(self):
     from_string('''
     T: dapt/alsa
     ''')
     self.assertEqual(['dapt/alsa'], [
         g.gitpath for g in GitTree.objects.filter(
             subdomain__name='Uncategorized',
             subdomain__domain__name='Uncategorized')
     ])
Exemple #25
0
    def test_add_two_domains(self):
        from_string('''
            D: Another

            D: System
            ''')
        self.assertEqual(
            [('Another',), ('System',), ('Uncategorized',)],
            list(Domain.objects.all().order_by('name').values_list('name'))
        )
Exemple #26
0
    def test_add_subdomain_maintainer(self):
        from_string('''
        D: System

        D: System / Clock
        N: System
        M: Mike <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in SubDomainRole.objects.get(
                subdomain__name='Clock', role="MAINTAINER").user_set.all()])
Exemple #27
0
    def test_roles_transform(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>
        M: Lily David <*****@*****.**>
        I: <*****@*****.**>
        R: Tom Frédéric <*****@*****.**>
        ''')

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        M: Mike <*****@*****.**>
        R: Lily David <*****@*****.**>
        A: <*****@*****.**>
        I: Tom Frédéric <*****@*****.**>
        ''')
        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role="ARCHITECT").user_set.all()
        ])
        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role="REVIEWER").user_set.all()
        ])
        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role="MAINTAINER").user_set.all()
        ])
        self.assertEqual(['Frédéric'], [
            i.last_name.encode('utf8')
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role="INTEGRATOR").user_set.all()
        ])
        self.assertEqual([
            '*****@*****.**', '*****@*****.**', '*****@*****.**',
            '*****@*****.**'
        ], [u.email for u in User.objects.all().order_by('email')])
    def test_roles_transform(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        A: Mike <*****@*****.**>
        M: Lily David <*****@*****.**>
        I: <*****@*****.**>
        R: Tom Frédéric <*****@*****.**>
        ''')

        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        M: Mike <*****@*****.**>
        R: Lily David <*****@*****.**>
        A: <*****@*****.**>
        I: Tom Frédéric <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role="ARCHITECT").user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role="REVIEWER").user_set.all()])
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role="MAINTAINER").user_set.all()])
        self.assertEqual(
            ['Frédéric'],
            [i.last_name.encode('utf8') for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role="INTEGRATOR").user_set.all()])
        self.assertEqual([
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**'
        ], [
            u.email for u in User.objects.all().order_by('email')
        ])
Exemple #29
0
    def test_gitpath_include_colon(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa:sde
        D: System / Alarm
        ''')
        self.assertEqual(['dapt/alsa:sde'], [
            g.gitpath for g in GitTree.objects.filter(subdomain__name='Alarm')
        ])
Exemple #30
0
    def test_add_one_subdomain(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System
        ''')
        self.assertEquals(
            [('Alarm', )],
            list(SubDomain.objects.filter(
                domain__name='System').exclude(
                    name='Uncategorized').values_list('name'))
        )
Exemple #31
0
    def test_adding_domain_maintainer(self):
        from_string('''
        D: System
        M: Mike <*****@*****.**>
        ''')

        self.assertEquals(
            [('*****@*****.**',)],
            list(DomainRole.objects.get(
                domain__name='System',
                role='MAINTAINER').user_set.all(
                ).values_list('email'))
        )
Exemple #32
0
    def test_subdomain_includes_slash_colon(self):
        from_string('''
        D: System

        D: System / Alarm:Clock/Hash
        N: System
        ''')
        self.assertEquals(
            [('Alarm:Clock/Hash', )],
            list(SubDomain.objects.filter(
                domain__name='System').exclude(
                    name='Uncategorized').values_list('name'))
        )
Exemple #33
0
    def test_add_one_GitTree(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa
        D: System / Alarm
        ''')
        self.assertEqual(['dapt/alsa'], [
            g.gitpath for g in GitTree.objects.filter(subdomain__name='Alarm')
        ])
Exemple #34
0
    def test_delete_two_domains(self):
        from_string('''
            D: Another

            D: System

            D: App Framework
            ''')
        from_string('D: App Framework')

        self.assertEqual(
            [('App Framework',)],
            list(Domain.objects.exclude(name='Uncategorized').values_list('name'))
        )
Exemple #35
0
    def test_adding_two_subdomain_reviewers(self):
        from_string('''
        D: System

        D: System / Clock
        N: System
        R: Mike <*****@*****.**>
        R: Lucy David <*****@*****.**>
        ''')
        self.assertEqual(
            ['Lucy', 'Mike'],
            [i.first_name.encode('utf8') for i in SubDomainRole.objects.get(
                subdomain__name='Clock',
                role='REVIEWER').user_set.all().order_by('first_name')])
Exemple #36
0
    def test_adding_two_domain_reviewers(self):
        from_string('''
        D: System
        R: Mike <*****@*****.**>
        R: Lucy David <*****@*****.**>
        ''')

        self.assertEqual(
            [(u'Lucy',), (u'Mike',)],
            list(DomainRole.objects.get(
                domain__name='System',
                role='REVIEWER').user_set.all(
                ).order_by('first_name').values_list('first_name'))
        )
    def test_delete_gittree(self):
        ''' delete gitree: ad/alsa '''
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System

        T: ad/face
        D: System / Alarm

        T: ad/alsa
        D: System / Alarm

        T: apps/core/preloaded/email
        D: System / Call
        ''')

        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System

        T: ad/face
        D: System / Alarm

        T: apps/core/preloaded/email
        D: System / Call
        ''')

        self.assertEqual([
            'ad/face',
            'apps/core/preloaded/email'
        ], [
            g.gitpath for g in GitTree.objects.all().order_by('gitpath')
        ])
        self.assertEqual(
            ['ad/face'],
            [g.gitpath for g in GitTree.objects.filter(
                subdomain__name='Alarm')])
        self.assertEqual(
            ['apps/core/preloaded/email'],
            [g.gitpath for g in GitTree.objects.filter(subdomain__name='Call')])
    def test_gitpath_include_colon(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa:sde
        D: System / Alarm
        ''')
        self.assertEqual(
            ['dapt/alsa:sde'],
            [g.gitpath for g in GitTree.objects.filter(
                subdomain__name='Alarm')])
    def test_add_one_GitTree(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa
        D: System / Alarm
        ''')
        self.assertEqual(
            ['dapt/alsa'],
            [g.gitpath for g in GitTree.objects.filter(
                subdomain__name='Alarm')])
Exemple #40
0
    def test_delete_all_subdomains(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System
        ''')
        from_string('D: System')

        self.assertEqual(
            ['Uncategorized'],
            [s.name for s in SubDomain.objects.filter(domain__name='System')])
    def test_add_gittree_maintainer(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        M: Mike <*****@*****.**>
        ''')
        self.assertEqual(
            ['*****@*****.**'],
            [i.email for i in GitTreeRole.objects.get(
                gittree__gitpath='a/b', role="MAINTAINER").user_set.all()])
Exemple #42
0
    def test_add_one_license_for_gittree(self):
        License.objects.create(shortname='BSD-2-Clause')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa
        D: System / Alarm
        L: BSD-2-Clause
        ''')
        self.assertEqual(['BSD-2-Clause'], [
            l.shortname
            for l in License.objects.filter(gittree__gitpath='dapt/alsa')
        ])
Exemple #43
0
    def test_add_gittree_maintainer(self):
        from_string('''
        D: System

        D: System / Clock
        N: System

        T: a/b
        D: System / Clock
        M: Mike <*****@*****.**>
        ''')
        self.assertEqual(['*****@*****.**'], [
            i.email
            for i in GitTreeRole.objects.get(gittree__gitpath='a/b',
                                             role="MAINTAINER").user_set.all()
        ])
Exemple #44
0
 def test_delete_all_roles(self):
     from_string('''
     D: System
     R: Mike <*****@*****.**>
     A: Lucy David <*****@*****.**>
     I: <*****@*****.**>
     M: <*****@*****.**>
     ''')
     from_string('''
     D: System
     ''')
     for role in ROLES:
         self.assertEqual(
             [],
             [r.role for r in DomainRole.objects.filter(
                 domain__name='System', role=role)])
    def test_add_one_license_for_gittree(self):
        License.objects.create(shortname='BSD-2-Clause')
        from_string('''
        D: System

        D: System / Alarm
        N: System

        T: dapt/alsa
        D: System / Alarm
        L: BSD-2-Clause
        ''')
        self.assertEqual(
            ['BSD-2-Clause'],
            [l.shortname for l in License.objects.filter(
                gittree__gitpath='dapt/alsa')])
Exemple #46
0
    def test_add_two_subdomains(self):
        from_string('''
        D: System

        D: System / Alarm
        N: System

        D: System / Call
        N: System
        ''')
        self.assertEqual(
            [('Alarm',), ('Call',)],
            list(SubDomain.objects.filter(
                domain__name='System').exclude(
                    name='Uncategorized').order_by(
                        'name').values_list('name'))
        )