def setUp(self): self.test_bi = [ BasicInfo('com.github.mogproject', 'xxx-yyy-assembly', '0.1-SNAPSHOT', 'jar', None), BasicInfo('com.github.mogproject', 'xxx-yyy-assembly', '0.1.2あ', 'zip', 345), ] self.test_fi = [ FileInfo('HOST', 'USER', 0, datetime(2014, 12, 31, 12, 34, 56), '0'), FileInfo('HOST', 'USERあ', 10000000000000000000000000000, datetime(2014, 12, 31, 12, 34, 56), 'ffff'), ] self.test_si = [ GitInfo('master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff'), GitInfo('master', ['release_YYYYMMDD', 'TAG'], 'AUTHORあいう', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSGかきく', '0123'), ] self.test_data = [ Artifact(self.test_bi[0], self.test_fi[0], self.test_si[0]), Artifact(self.test_bi[1], self.test_fi[1], self.test_si[1]), Artifact(self.test_bi[0], self.test_fi[0], None), ]
def setUp(self): self.test_data = [ GitInfo('master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff'), GitInfo('master', ['release_YYYYMMDD', 'TAG'], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', '0123'), ]
def test_ne(self): self.assertFalse(self.test_data[0] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[1] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'masterX', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'master', [], 'AUTHORX', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56, 1), 'COMMIT MSG', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSGX', 'ffff')) self.assertTrue(self.test_data[0] != GitInfo( 'master', [], 'AUTHOR', '*****@*****.**', datetime(2014, 12, 31, 12, 34, 56), 'COMMIT MSG', 'fffe'))
def test_dict_conversions(self): self.assertEqual(GitInfo.from_dict(self.test_data[0].to_dict()), self.test_data[0]) self.assertEqual(GitInfo.from_dict(self.test_data[1].to_dict()), self.test_data[1])
def test_from_path_error(self): self.assertEqual(GitInfo.from_path('tests/resources/test001_no_such_path.dat'), None) self.assertEqual(GitInfo.from_path('/'), None)
def test_from_path(self): gi = GitInfo.from_path('tests/resources/test-artifact-1.2.3.dat') self.assertFalse(gi is None)
def test_from_path_error(self): self.assertEqual( GitInfo.from_path('tests/resources/test001_no_such_path.dat'), None) self.assertEqual(GitInfo.from_path('/'), None)