Add protections around changes pretty_print
[integration/test.git] / tools / distchanges / tests / test_changes.py
index 7d373f197e288893ebdd5b0c3776f756f4d771a4..490af38037dfb6d65eaa565af0b1e4e17e8d46ce 100644 (file)
@@ -26,13 +26,33 @@ class TestChanges(unittest.TestCase):
         changes.pretty_print_projects(projects)
 
     def test_run_cmd_single(self):
-        project_names = ['netconf']
+        project_names = ['odlparent']
         self.run_cmd(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
 
     def test_run_cmd_multiple(self):
         project_names = PROJECT_NAMES
         self.run_cmd(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
 
+    def test_pretty_print(self):
+        project_names = PROJECT_NAMES
+        changes = Changes(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
+        projects = {}
+        for project in project_names:
+            projects[project] = {"commit": 1, "includes": [{'a': 1}]}
+        changes.pretty_print_projects(projects)
+        for project in project_names:
+            projects[project] = {"commit": 1,
+                                 "includes": [{"grantedOn": 1, "lastUpdated": 11,
+                                               "number": "12345", "subject": "This is a test for " + project},
+                                              {"grantedOn": 2, "lastUpdated": 22,
+                                               "number": "56789", "subject": "This is a test for " + project}]}
+        changes.pretty_print_projects(projects)
+
+    def test_epoch_to_utc(self):
+        project_names = PROJECT_NAMES
+        changes = Changes(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
+        print("utc: %s" % changes.epoch_to_utc(1483974872))
+
 
 if __name__ == '__main__':
     unittest.main()