Example #1
0
 def test_export_questions(self, mock_output):
     mock_output.return_value = self.mock_assemble_output_value
     timestamp = datetime.datetime.now().strftime("%Y-%m-%d")
     slug = 'ask-cfpb-{}.csv'.format(timestamp)
     m = mock.mock_open()
     with mock.patch('six.moves.builtins.open', m, create=True):
         export_questions()
     self.assertEqual(mock_output.call_count, 1)
     m.assert_called_once_with("/tmp/{}".format(slug), 'w')
 def test_export_questions(self, mock_output):
     mock_output.return_value = self.mock_assemble_output_value
     timestamp = datetime.datetime.now().strftime("%Y-%m-%d")
     slug = 'ask-cfpb-{}.csv'.format(timestamp)
     m = mock.mock_open()
     with mock.patch('six.moves.builtins.open', m, create=True):
         export_questions()
     self.assertEqual(mock_output.call_count, 1)
     m.assert_called_once_with("/tmp/{}".format(slug), 'w')
def export_data(request):
    if request.method == 'POST':
        return export_ask_data.export_questions(http_response=True)
    return render(request, 'admin/export.html')
Example #4
0
def export_data(request):
    if request.method == 'POST':
        return export_ask_data.export_questions(http_response=True)
    return render(request, 'admin/export.html')