~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to horizon/horizon/tests/authors_tests.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-03-02 12:11:59 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20120302121159-65b88lcl4slve26i
Tags: 2012.1~e4-0ubuntu1
* New upstream version.
* debian/rules: Update due to upstream build changes.
* debian/control: Update standards-version.
* debian/patches/openstack-config-settings.patch: Dropped
* debian/patches/fix-dashboard-django-wsgi.patch: Refreshed
* debian/patches/fix-dashboard-manage.patch: Refreshed
* debian/openstack-dashboard.install: Update due to upstream build changes.
* debian/dashboard: Update to upstream build changes.
* debian/pydist-overrides: Dont try to install python-django-nose-selenium.
* debian/openstack-dashboard.install: Add missing config files.
* debian/rules: Fix broken settings.py
* debian/patches/pkg-setup.patch: Copy missing templates, shameously
  taken from debian
* debian/patches/fix-broken-tarbll.patch: Add missing files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
 
3
 
# Copyright 2012 OpenStack LLC
4
 
# Copyright 2012 Nebula Inc
5
 
#
6
 
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
 
# not use this file except in compliance with the License. You may obtain
8
 
# a copy of the License at
9
 
#
10
 
#      http://www.apache.org/licenses/LICENSE-2.0
11
 
#
12
 
# Unless required by applicable law or agreed to in writing, software
13
 
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
 
# License for the specific language governing permissions and limitations
16
 
# under the License.
17
 
 
18
 
import os
19
 
import commands
20
 
import unittest
21
 
 
22
 
 
23
 
def parse_mailmap(mailmap='.mailmap'):
24
 
    mapping = {}
25
 
    if os.path.exists(mailmap):
26
 
        fp = open(mailmap, 'r')
27
 
        for l in fp:
28
 
            l = l.strip()
29
 
            if not l.startswith('#') and ' ' in l:
30
 
                canonical_email, alias = l.split(' ')
31
 
                mapping[alias] = canonical_email
32
 
    return mapping
33
 
 
34
 
 
35
 
def str_dict_replace(s, mapping):
36
 
    for s1, s2 in mapping.iteritems():
37
 
        s = s.replace(s1, s2)
38
 
    return s
39
 
 
40
 
 
41
 
class AuthorsTestCase(unittest.TestCase):
42
 
    def test_authors_up_to_date(self):
43
 
        path_bits = (os.path.dirname(__file__), '..', '..', '..')
44
 
        root = os.path.normpath(os.path.join(*path_bits))
45
 
        contributors = set()
46
 
        missing = set()
47
 
        authors_file = open(os.path.join(root, 'AUTHORS'), 'r').read()
48
 
 
49
 
        if os.path.exists(os.path.join(root, '.git')):
50
 
            mailmap = parse_mailmap(os.path.join(root, '.mailmap'))
51
 
            for email in commands.getoutput('git log --format=%ae').split():
52
 
                if not email:
53
 
                    continue
54
 
                if "jenkins" in email and "openstack.org" in email:
55
 
                    continue
56
 
                email = '<' + email + '>'
57
 
                contributors.add(str_dict_replace(email, mailmap))
58
 
 
59
 
        for contributor in contributors:
60
 
            if not contributor in authors_file:
61
 
                missing.add(contributor)
62
 
 
63
 
        self.assertTrue(len(missing) == 0,
64
 
                        '%r not listed in AUTHORS file.' % missing)