view tests/unit.py @ 34:463dc92867df

commitwatcher/event.py
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 13 Oct 2013 19:17:34 -0700
parents 77118f83b5b7
children 32cf3d3469c3
line wrap: on
line source

#!/usr/bin/env python

"""
unit tests
"""

import os
import sys
import unittest

from commitwatcher import FeedAgentDiff

# globals
here = os.path.dirname(os.path.abspath(__file__))

class CommitWatcherUnitTest(unittest.TestCase):

    # diff -> files mapping, from `lsdiff`
    diff_files = [('41701d2c0341.diff', ['mobile/android/components/HelperAppDialog.js']),
                  ('4e1a3919e741.diff', ["gfx/gl/GLContext.cpp",
                                         "gfx/gl/GLContext.h",
                                         "gfx/layers/Compositor.h",
                                         "gfx/layers/Layers.cpp",
                                         "gfx/layers/Layers.h",
                                         "gfx/layers/basic/BasicCompositor.cpp",
                                         "gfx/layers/basic/BasicCompositor.h",
                                         "gfx/layers/composite/LayerManagerComposite.cpp",
                                         "gfx/layers/composite/LayerManagerComposite.h",
                                         "gfx/layers/d3d11/CompositorD3D11.cpp",
                                         "gfx/layers/d3d11/CompositorD3D11.h",
                                         "gfx/layers/d3d9/CompositorD3D9.cpp",
                                         "gfx/layers/d3d9/CompositorD3D9.h",
                                         "gfx/layers/ipc/CompositorParent.cpp",
                                         "gfx/layers/ipc/CompositorParent.h",
                                         "gfx/layers/ipc/LayerTransactionParent.cpp",
                                         "gfx/layers/opengl/CompositorOGL.cpp",
                                         "gfx/layers/opengl/CompositorOGL.h",
                                         "gfx/thebes/gfx2DGlue.h",
                                         ])
                                        ]
    def test_patch(self):
        """test parsing the files from a patch"""

        for diff, filenames in self.diff_files:
            diff = os.path.join(here, diff)
            files = FeedAgentDiff.lsdiff(diff)

if __name__ == '__main__':
    unittest.main()