Esempio n. 1
0
 def test_clone(self):
     ns = M.Notification.query.find().count()
     with mock.patch.object(c.app.repo, "init_as_clone") as f:
         repo_tasks.clone("foo", "bar", "baz")
         M.main_orm_session.flush()
         f.assert_called_with("foo", "bar", "baz")
         assert ns + 1 == M.Notification.query.find().count()
Esempio n. 2
0
 def test_clone(self):
     ns = M.Notification.query.find().count()
     with mock.patch.object(c.app.repo, 'init_as_clone') as f:
         repo_tasks.clone('foo', 'bar', 'baz')
         M.main_orm_session.flush()
         f.assert_called_with('foo', 'bar', 'baz')
         assert ns + 1 == M.Notification.query.find().count()
Esempio n. 3
0
 def test_clone_posts_event_on_failure(self, post_event, app):
     fake_source_url = 'fake_source_url'
     fake_traceback = 'fake_traceback'
     app.repo.init_as_clone.side_effect = Exception(fake_traceback)
     repo_tasks.clone(None, None, fake_source_url)
     assert_equal(post_event.call_args[0][0], 'repo_clone_task_failed')
     assert_equal(post_event.call_args[0][1], fake_source_url)
     assert_equal(post_event.call_args[0][2], None)
Esempio n. 4
0
 def test_clone_posts_event_on_failure(self, post_event, app):
     fake_source_url = 'fake_source_url'
     fake_traceback = 'fake_traceback'
     app.repo.init_as_clone.side_effect = Exception(fake_traceback)
     repo_tasks.clone(None, None, fake_source_url)
     assert_equal(post_event.call_args[0][0], 'repo_clone_task_failed')
     assert_equal(post_event.call_args[0][1], fake_source_url)
     assert_equal(post_event.call_args[0][2], None)
Esempio n. 5
0
 def test_clone(self):
     ns = M.Notification.query.find().count()
     with mock.patch.object(c.app.repo, 'init_as_clone') as f:
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
             repo_tasks.clone('foo', 'bar', 'baz')
             M.main_orm_session.flush()
             f.assert_called_with('foo', 'bar', 'baz', False)
             assert ns + 1 == M.Notification.query.find().count()