3 # TODO: Add more tests here using all the tests/resources/* and automate those tests in a verify job
8 from changes import Changes
10 REMOTE_URL = 'ssh://git.opendaylight.org:29418'
11 NETVIRT_PROJECTS = ["controller", "dlux", "dluxapps", "genius", "infrautils", "mdsal", "netconf", "netvirt",
12 "neutron", "odlparent", "openflowplugin", "ovsdb", "sfc", "yangtools"]
13 PROJECT_NAMES = NETVIRT_PROJECTS
14 DISTRO_PATH = "/tmp/distribution-karaf"
20 class TestChanges(unittest.TestCase):
23 print("Starting test: %s" % self.id())
26 def run_cmd(branch, distro_patch, limit, qlimit, project_names, remote_url, loglevel=0):
27 changes = Changes(branch, distro_patch, limit, qlimit, project_names, remote_url, loglevel)
28 projects = changes.run_cmd()
29 changes.pretty_print_projects(projects)
31 def test_run_cmd_single(self):
32 project_names = ['netvirt']
34 self.run_cmd(branch, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL, logging.INFO)
36 def test_run_cmd_multiple(self):
37 project_names = PROJECT_NAMES
39 self.run_cmd(branch, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL, logging.INFO)
41 def test_pretty_print(self):
42 project_names = PROJECT_NAMES
43 changes = Changes(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
45 for project in project_names:
46 projects[project] = {"commit": 1, "includes": [{'a': 1}]}
47 changes.pretty_print_projects(projects)
48 for project in project_names:
49 projects[project] = {"commit": 1,
50 "includes": [{"grantedOn": 1, "lastUpdated": 11,
51 "number": "12345", "subject": "This is a test for " + project},
52 {"grantedOn": 2, "lastUpdated": 22,
53 "number": "56789", "subject": "This is a test for " + project}]}
54 changes.pretty_print_projects(projects)
56 def test_epoch_to_utc(self):
57 project_names = PROJECT_NAMES
58 changes = Changes(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
59 print("utc: %s" % changes.epoch_to_utc(1483974872))
61 def test_distcompare(self):
65 if __name__ == '__main__':