Skip to content

Commit

Permalink
Update test for db handling of multiple static fields.
Browse files Browse the repository at this point in the history
This test would have caught issue #490 and also checks static fields
work.
  • Loading branch information
cthulahoops authored and ryneeverett committed Jun 25, 2017
1 parent 7b935b8 commit b2f7463
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def get_tasks(tw):
config = ConfigParser.RawConfigParser()
config.add_section('general')
config.set('general', 'targets', 'my_service')
config.set('general', 'static_fields', 'project, priority')
config.add_section('my_service')
config.set('my_service', 'service', 'github')

Expand All @@ -66,6 +67,7 @@ def get_tasks(tw):

issue = {
'description': 'Blah blah blah. ☃',
'project': 'sample_project',
'githubtype': 'issue',
'githuburl': 'https://example.com',
'priority': 'M',
Expand All @@ -78,30 +80,35 @@ def get_tasks(tw):
self.assertEqual(get_tasks(tw), {
'completed': [],
'pending': [{
u'project': u'sample_project',
u'priority': u'M',
u'status': u'pending',
u'description': u'Blah blah blah. ☃',
u'githuburl': u'https://example.com',
u'githubtype': u'issue',
u'id': 1,
u'urgency': 3.9,
u'urgency': 4.9,
}]})

# TEST CHANGED ISSUE.
issue['description'] = 'Yada yada yada.'

# Change static field
issue['project'] = 'other_project'

db.synchronize(iter((issue,)), config, 'general')

self.assertEqual(get_tasks(tw), {
'completed': [],
'pending': [{
u'priority': u'M',
u'project': u'sample_project',
u'status': u'pending',
u'description': u'Yada yada yada.',
u'githuburl': u'https://example.com',
u'githubtype': u'issue',
u'id': 1,
u'urgency': 3.9,
u'urgency': 4.9,
}]})

# TEST CLOSED ISSUE.
Expand All @@ -117,13 +124,14 @@ def get_tasks(tw):

self.assertEqual(tasks, {
'completed': [{
u'project': u'sample_project',
u'description': u'Yada yada yada.',
u'githubtype': u'issue',
u'githuburl': u'https://example.com',
u'id': 0,
u'priority': u'M',
u'status': u'completed',
u'urgency': 3.9,
u'urgency': 4.9,
}],
'pending': []})

Expand Down

0 comments on commit b2f7463

Please sign in to comment.