Example #1
0
    def setUp(self):
        self.changesets = [Changeset(filepaths=['test']),
                           Changeset(filepaths=['test'], epochTime=OCT_2_1980_EPOCH),
                           Changeset(filepaths=['test'], branch='another branch'),
                           Changeset(filepaths=['code'])]

        self.fickle = Fickle('.')
        self.fickle.changesets = lambda: self.changesets
    def test_2_changesets_in_2_months(self):
        changesets = [
            Changeset(epochTime=OCT_1980_EPOCH),
            Changeset(epochTime=NOV_1980_EPOCH)
        ]

        monthly = group_by_month(changesets)
        months = []
        changes = []
        for k, g in monthly:
            months.append(k)
            changes.append(list(g))

        self.assertEquals(2, len(months))
        self.assertEquals('1980-10', months[0])
        self.assertEquals('1980-11', months[1])

        self.assertEquals(2, len(changes))
        self.assertEquals(1, len(changes[0]))
        self.assertEquals(1, len(changes[1]))
Example #3
0
 def test_only_code_file_is_not_tdded(self):
     self.assertFalse(self.testedFilter(Changeset(filepaths=['filecode'])))
Example #4
0
 def test_not_matching_user_returns_false(self):
     self.assertFalse(ByUsers(['A User'])(Changeset(user='******')))
Example #5
0
 def test_matching_user_returns_true(self):
     self.assertTrue(ByUsers(['A User'])(Changeset(user='******')))
Example #6
0
 def test_partial_matches(self):
     self.assertTrue(ByUsers(['user'])(Changeset(user='******')))
Example #7
0
 def test_any_matching_user_passes(self):
     self.assertTrue(
         ByUsers(['A User', 'B User'])(Changeset(user='******')))
Example #8
0
 def test_matching_extension_must_be_at_end_preceeded_by_point(self):
     self.assertFalse(ByExtensions(['cpp'])(Changeset(['noextensioncpp'])))
Example #9
0
 def test_case_insensitive(self):
     self.assertTrue(ByUsers(['A USER'])(Changeset(user='******')))
Example #10
0
 def test_default_branch_returns_true(self):
     self.assertTrue(self.default_filter(Changeset(branch='default')))
Example #11
0
 def test_filter_branch_other_than_default(self):
     self.assertTrue(self.other_filter(Changeset(branch='other')))
Example #12
0
 def test_only_test_file_is_considered_tdded(self):
     self.assertTrue(self.testedFilter(Changeset(filepaths=['filetest'])))
Example #13
0
 def test_does_not_care_about_case(self):
     self.assertTrue(self.testedFilter(Changeset(filepaths=['FILETEST'])))
Example #14
0
    def test_changeset_exactly_on_date_false(self):
        after_date_filter = AfterDate(self.OCT_3_1980_DATE)

        self.assertFalse(
            after_date_filter(Changeset(epochTime=self.OCT_3_1980_EPOCH)))
Example #15
0
    def test_changeset_after_date_true(self):
        after_date_filter = AfterDate(self.OCT_2_1980_DATE)

        self.assertTrue(
            after_date_filter(Changeset(epochTime=self.OCT_3_1980_EPOCH)))
Example #16
0
 def test_matching_extensions_returns_true(self):
     self.assertTrue(ByExtensions(['h'])(Changeset(['headerfile.h'])))
Example #17
0
 def test_not_matching_extension_returns_false(self):
     self.assertFalse(ByExtensions(['cpp'])(Changeset(['script.py'])))
Example #18
0
 def test_matches_with_any_of_multiple_extensions(self):
     self.assertTrue(ByExtensions(['py', 'cpp'])(Changeset(['codefile.cpp'])))
Example #19
0
 def test_other_branch_returns_false(self):
     self.assertFalse(self.default_filter(Changeset(branch='other')))
Example #20
0
 def test_code_and_test_testedFilter(self):
     self.assertTrue(
         self.testedFilter(Changeset(filepaths=['filecode', 'testcode'])))
Example #21
0
 def test_no_file_changes_is_not_tdd(self):
     self.assertFalse(self.testedFilter(Changeset(filepaths=[])))
Example #22
0
 def test_will_match_any_of_multiple_files(self):
     self.assertTrue(ByExtensions(['py'])(Changeset(['codefile.cpp', 'script.py'])))