def test_generate_from_request_with_grain(self): mock_obj = MagicMock() mock_obj.json = { 'action_instance_id': 1, 'pipeline_instance_id': 2, 'grain': 'foobar' } work_request = WorkRequest() work_request.generate_from_request(mock_obj) eq_(1, work_request.action_instance_id) eq_(2, work_request.pipeline_instance_id) eq_('foobar', work_request.grain)
def test_invalid_key_will_not_error(self): work_request = WorkRequest() work_request.generate_from_request(Mock(json={"bogus": "bogus_2"}))