def testTemplate001(self):
     self.c.options.template = "./test/data/project-001.yaml"
     self.c.create_issues_from_template()
     desired_epic = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "description": "Test Epic description",
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "6"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "This is a test Epic",
     }
     desired_subtask = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "5"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "parent": {"key": "NOOP"},
         "summary": "This is test epic subtask 1",
         "description": "This is test epic subtask 1 description",
     }
     epic = self.c.issues_created[0]
     diff = DictDiffer(epic, desired_epic)
     assert diff.areEqual()
     subtask = self.c.issues_created[1]
     diff = DictDiffer(subtask, desired_subtask)
     assert diff.areEqual()
Beispiel #2
0
 def testCreateIssueObj(self):
   self.c.options.issuetype = 'story'
   self.c.options.summary = 'Summary'
   self.c.options.description = 'Description'
   self.c.options.priority = 'normal'
   self.c.options.project = 'INFOSYS'
   self.c.options.assignee = 'jirauser'
   self.c.options.components = 'csa'
   self.c.options.fixVersions = '10033'
   self.c.get_priorities()
   i = self.c.create_issue_obj('story',defaults=True)
   desired = {
    'environment': '',
    'duedate': '',
    'labels': [],
    'assignee': {'name':'jirauser'},
    'components': [{'id': '10111'}],
    'versions': [{'id': None}],
    'parent': {'key':None},
    'description': 'Description',
    'fixVersions': [{'id': '10033'}],
    'priority': {'id':'6'},
    'project': {'id':'10001'},
    'timetracking': {'originalEstimate':None},
    'summary': 'Summary',
    'issuetype': {'id':'7'}
   }
   diff = DictDiffer(i.__dict__,desired)
   assert diff.areEqual()
Beispiel #3
0
    def load_and_compare(cls):
        """
        Loads the DB from MongoDB (If the selected Document doesn't exist we create it). Checks for changes and calls
        send_mail for every change. In the end we write back the Table to the DataBase. Due to the small maximum size
        of the Table we remove the old one and insert the new.
        :return
        True - if there was a change
        False - if there was no change
        """
        change = False
        client = MongoClient(dbURI)
        coll = client.test.work
        cur = coll.find()
        if cur.count() == 0:
            coll.insert(cls.TableStr)
            return

        tmpdic = {}
        for i in cur:
            tmpdic.update(i)
        diff = DictDiffer(tmpdic, cls.TableStr)
        for i in diff.changed():
            if cls.TableStr[i][0] != tmpdic[i][0]:
                change = True
                cls.TableObj[i][0].send_mail()
            if cls.TableStr[i][1] != tmpdic[i][1]:
                change = True
                cls.TableObj[i][1].send_mail()

        coll.remove({})
        coll.insert(cls.TableStr)
        return change
Beispiel #4
0
    def testCreateIssueObj(self):
        # command line or rc file input
        self.c.options.noop = False
        self.c.options.assignee = 'jirauser'
        self.c.options.components = 'csa'
        self.c.options.description = 'description'
        self.c.options.duedate = '2012-04-13'
        self.c.options.environment = 'environment'
        self.c.options.fixVersions = 'Backlog'
        self.c.options.issuetype = 'task'
        self.c.options.labels = 'change,maintenance'
        self.c.options.priority = 'minor'
        self.c.options.project = 'INFOSYS'
        self.c.options.summary = 'summary'
        #self.c.options.timetracking = '2h'
        self.c.options.versions = 'Ideas'
        self.c.options.epic_theme = 'INFOSYS-100'

        issue = self.c.create_issue_obj('task')
        got = issue.__dict__
        desired = {
            'assignee': {
                'name': 'jirauser'
            },
            'components': [{
                'id': '10111'
            }],
            'description': 'description',
            'duedate': '2012-04-13',
            'environment': 'environment',
            'fixVersions': [{
                'id': '10020'
            }],
            'issuetype': {
                'id': '3'
            },
            'labels': ['change', 'maintenance'],
            'priority': {
                'id': '4'
            },
            'project': {
                'id': '10001'
            },
            'summary': 'summary',
            'parent': {
                'key': None
            },
            'timetracking': {
                'originalEstimate': None
            },
            'versions': [{
                'id': '10080'
            }],
            'customfield_10010': ['INFOSYS-100'],
        }
        diff = DictDiffer(got, desired)
        assert diff.areEqual()
Beispiel #5
0
 def find_deltas(self):
     """ use DictDiffer to find differences between target and source databases """
     logging.info('finding deltas..')
     delta = DictDiffer(self.source['row'], self.target['row'])
     self.database['deltas'] = {
         'new_columns_in_source': delta.added(),
         'new_columns_in_target': delta.removed(),
         'delta_columns': delta.changed(),
         'unchanged_columns': delta.unchanged()
     }
Beispiel #6
0
 def testGetResolutions(self):
     self.c.get_resolutions()
     desired = {
         '5': 'cannot reproduce',
         '6': 'complete',
         '3': 'duplicate',
         '1': 'fixed',
         '4': 'incomplete',
         '2': "won't fix"
     }
     diff = DictDiffer(self.c.maps['resolutions'], desired)
     assert diff.areEqual()
Beispiel #7
0
 def testCreateIssueObj(self):
     self.c.options.issuetype = 'story'
     self.c.options.summary = 'Summary'
     self.c.options.description = 'Description'
     self.c.options.priority = 'normal'
     self.c.options.project = 'INFOSYS'
     self.c.options.assignee = 'jirauser'
     self.c.options.components = 'csa'
     self.c.options.fixVersions = '10033'
     self.c.get_priorities()
     i = self.c.create_issue_obj('story', defaults=True)
     desired = {
         'environment': '',
         'duedate': '',
         'labels': [],
         'assignee': {
             'name': 'jirauser'
         },
         'components': [{
             'id': '10111'
         }],
         'versions': [{
             'id': None
         }],
         'parent': {
             'key': None
         },
         'description': 'Description',
         'fixVersions': [{
             'id': '10033'
         }],
         'priority': {
             'id': '6'
         },
         'project': {
             'id': '10001'
         },
         'timetracking': {
             'originalEstimate': None
         },
         'summary': 'Summary',
         'issuetype': {
             'id': '7'
         }
     }
     diff = DictDiffer(i.__dict__, desired)
     assert diff.areEqual()
Beispiel #8
0
 def testTemplate000(self):
   self.c.options.template = "./test/data/project-000.yaml"
   self.c.create_issues_from_template()
   desired = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'description': 'Epic description',
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '6'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 'This is an Epic'
    }
   for got in self.c.issues_created:
     diff = DictDiffer(got,desired)
     assert diff.areEqual()
 def testTemplate000(self):
     self.c.options.template = "./test/data/project-000.yaml"
     self.c.create_issues_from_template()
     desired = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "description": "Epic description",
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "6"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "This is an Epic",
     }
     for got in self.c.issues_created:
         diff = DictDiffer(got, desired)
         assert diff.areEqual()
Beispiel #10
0
 def testGetCustomFields(self):
   self.c.check_auth()
   pp.pprint(self.c.__dict__)
   self.c.get_project_id('INFOSYS')
   assert self.c.maps['project']['10001'] == 'infosys'
   self.c.get_issue_types('INFOSYS')
   assert self.c.maps['issuetype']['6'] == 'epic'
   self.c.get_customfields('INFOSYS','6')
   desired = { '6': {
           'customfield_10010': 'epic/theme',
           'customfield_10002': 'story points',
           'customfield_10003': 'business value',
           'customfield_10000': 'flagged',
           'customfield_10441': 'epic name',
           'customfield_10440': 'epic link'
           }}
   diff = DictDiffer(self.c.maps['customfields'],desired)
   assert diff.areEqual()
Beispiel #11
0
 def testGetCustomFields(self):
     self.c.check_auth()
     pp.pprint(self.c.__dict__)
     self.c.get_project_id('INFOSYS')
     assert self.c.maps['project']['10001'] == 'infosys'
     self.c.get_issue_types('INFOSYS')
     assert self.c.maps['issuetype']['6'] == 'epic'
     self.c.get_customfields('INFOSYS', '6')
     desired = {
         '6': {
             'customfield_10010': 'epic/theme',
             'customfield_10002': 'story points',
             'customfield_10003': 'business value',
             'customfield_10000': 'flagged',
             'customfield_10441': 'epic name',
             'customfield_10440': 'epic link'
         }
     }
     diff = DictDiffer(self.c.maps['customfields'], desired)
     assert diff.areEqual()
Beispiel #12
0
 def testCreateSimpleIssue(self):
     self.c.options.project = "INFOSYS"
     issue = self.c.create_issue_obj('task')
     got = issue.__dict__
     desired = {
         'assignee': {
             'name': None
         },
         'components': [{
             'id': None
         }],
         'description': '',
         'duedate': '',
         'environment': '',
         'fixVersions': [{
             'id': None
         }],
         'issuetype': {
             'id': '3'
         },
         'labels': [],
         'priority': {
             'id': None
         },
         'project': {
             'id': '00'
         },
         'parent': {
             'key': None
         },
         'summary': '',
         'timetracking': {
             'originalEstimate': None
         },
         'versions': [{
             'id': None
         }],
     }
     diff = DictDiffer(got, desired)
     assert diff.areEqual()
Beispiel #13
0
 def testTemplate001(self):
   self.c.options.template = "./test/data/project-001.yaml"
   self.c.create_issues_from_template()
   desired_epic = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'description': 'Test Epic description',
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '6'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 'This is a test Epic'
   }
   desired_subtask = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '5'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'parent': {'key': 'NOOP'},
    'summary': 'This is test epic subtask 1',
    'description': 'This is test epic subtask 1 description'
   }
   epic = self.c.issues_created[0]
   diff = DictDiffer(epic,desired_epic)
   assert diff.areEqual()
   subtask = self.c.issues_created[1]
   diff = DictDiffer(subtask,desired_subtask)
   assert diff.areEqual()
Beispiel #14
0
  def testCreateIssueObj(self):
    # command line or rc file input
    self.c.options.noop = False
    self.c.options.assignee = 'jirauser'
    self.c.options.components = 'csa'
    self.c.options.description = 'description'
    self.c.options.duedate = '2012-04-13'
    self.c.options.environment = 'environment'
    self.c.options.fixVersions = 'Backlog'
    self.c.options.issuetype = 'task'
    self.c.options.labels = 'change,maintenance'
    self.c.options.priority = 'minor'
    self.c.options.project = 'INFOSYS'
    self.c.options.summary = 'summary'
    #self.c.options.timetracking = '2h'
    self.c.options.versions = 'Ideas'
    self.c.options.epic_theme = 'INFOSYS-100'

    issue = self.c.create_issue_obj('task')
    got = issue.__dict__
    desired = {
      'assignee': {'name': 'jirauser'},
      'components': [{'id': '10111'}],
      'description': 'description',
      'duedate': '2012-04-13',
      'environment': 'environment',
      'fixVersions': [{'id': '10020'}],
      'issuetype': {'id': '3'},
      'labels': ['change', 'maintenance'],
      'priority': {'id': '4'},
      'project': {'id': '10001'},
      'summary': 'summary',
      'parent': {'key': None},
      'timetracking': {'originalEstimate': None},
      'versions': [{'id': '10080'}],
      'customfield_10010': ['INFOSYS-100'],
    }
    diff = DictDiffer(got,desired)
    assert diff.areEqual()
Beispiel #15
0
 def testCreateSimpleIssue(self):
   self.c.options.project = "INFOSYS"
   issue = self.c.create_issue_obj('task')
   got = issue.__dict__
   desired = {
     'assignee': {'name': None},
     'components': [{'id': None}],
     'description': '',
     'duedate': '',
     'environment': '',
     'fixVersions': [{'id': None}],
     'issuetype': {'id': '3'},
     'labels': [],
     'priority': {'id': None},
     'project': {'id': '00'},
     'parent': {'key': None},
     'summary': '',
     'timetracking': {'originalEstimate': None},
     'versions': [{'id': None}],
   }
   diff = DictDiffer(got,desired)
   assert diff.areEqual()
Beispiel #16
0
 def testTemplate002(self):
   self.c.options.template = "./test/data/project-002.yaml"
   self.c.create_issues_from_template()
   desired_epic = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'customfield_10441': 'The Epic Name',
    'description': 'Epic description',
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '6'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 'This is an Epic'
   }
   desired_subtask = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '5'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 'est1 summary',
    'parent': {'key':'NOOP'},
   }
   desired_story = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '7'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 's1 summary',
    'description': 'story s1 description',
    'timetracking': {'originalEstimate':'1h'},
   }
   desired_story_subtask = {
    'assignee': {'name': 'jirauser'},
    'components': [{'id': '10111'}],
    'customfield_10010': ['NOOP'],
    'fixVersions': [{'id': '10020'}],
    'issuetype': {'id': '5'},
    'priority': {'id': '6'},
    'project': {'id': '10001'},
    'summary': 's1 st1 summary',
    'description': 's1 st1 description',
    'timetracking': {'originalEstimate':'30m'},
    'parent': {'key':'NOOP'},
   }
   epic = self.c.issues_created[0]
   diff = DictDiffer(epic,desired_epic)
   assert diff.areEqual()
   subtask = self.c.issues_created[1]
   diff = DictDiffer(subtask,desired_subtask)
   assert diff.areEqual()
   story = self.c.issues_created[3]
   diff = DictDiffer(story,desired_story)
   assert diff.areEqual()
   subtask = self.c.issues_created[4]
   diff = DictDiffer(subtask,desired_story_subtask)
   assert diff.areEqual()
Beispiel #17
0
 def testGetIssueTypes(self):
   self.c.get_issue_types('INFOSYS')
   pp.pprint(self.c.maps['issuetype'])
   desired = { '6': 'epic', '7': 'story', '5': 'sub-task', '3': 'task'}
   diff = DictDiffer(self.c.maps['issuetype'],desired)
   assert diff.areEqual()
 def testTemplate002(self):
     self.c.options.template = "./test/data/project-002.yaml"
     self.c.create_issues_from_template()
     desired_epic = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "customfield_10441": "The Epic Name",
         "description": "Epic description",
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "6"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "This is an Epic",
     }
     desired_subtask = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "5"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "est1 summary",
         "parent": {"key": "NOOP"},
     }
     desired_story = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "7"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "s1 summary",
         "description": "story s1 description",
         "timetracking": {"originalEstimate": "1h"},
     }
     desired_story_subtask = {
         "assignee": {"name": "jirauser"},
         "components": [{"id": "10111"}],
         "customfield_10010": ["NOOP"],
         "fixVersions": [{"id": "10020"}],
         "issuetype": {"id": "5"},
         "priority": {"id": "6"},
         "project": {"id": "10001"},
         "summary": "s1 st1 summary",
         "description": "s1 st1 description",
         "timetracking": {"originalEstimate": "30m"},
         "parent": {"key": "NOOP"},
     }
     epic = self.c.issues_created[0]
     diff = DictDiffer(epic, desired_epic)
     assert diff.areEqual()
     subtask = self.c.issues_created[1]
     diff = DictDiffer(subtask, desired_subtask)
     assert diff.areEqual()
     story = self.c.issues_created[3]
     diff = DictDiffer(story, desired_story)
     assert diff.areEqual()
     subtask = self.c.issues_created[4]
     diff = DictDiffer(subtask, desired_story_subtask)
     assert diff.areEqual()
Beispiel #19
0
 def testGetIssueTypes(self):
     self.c.get_issue_types('INFOSYS')
     pp.pprint(self.c.maps['issuetype'])
     desired = {'6': 'epic', '7': 'story', '5': 'sub-task', '3': 'task'}
     diff = DictDiffer(self.c.maps['issuetype'], desired)
     assert diff.areEqual()
Beispiel #20
0
 def testGetResolutions(self):
   self.c.get_resolutions()
   desired = {'5': 'cannot reproduce', '6': 'complete', '3': 'duplicate', '1': 'fixed', '4': 'incomplete', '2': "won't fix"}
   diff = DictDiffer(self.c.maps['resolutions'],desired)
   assert diff.areEqual()