Skip to content
Snippets Groups Projects
Commit 007b30d9 authored by Carl Schaffer's avatar Carl Schaffer
Browse files

fixing chrotel tests finally

parent 833d0e12
No related branches found
No related tags found
1 merge request!88Gris coordinate verification
......@@ -5,11 +5,11 @@
Created by schaffer at 8/22/19
"""
from argparse import Namespace
from unittest import TestCase
from unittest.mock import patch
from main.chrotel_importer import main
from bson import ObjectId
from chrotel.ChrotelMongoClient import ChrotelMongoClient
from sdc_importer.bbi.settings import get_settings
from sdc_importer.generic import SDCMongoClient
......@@ -24,11 +24,16 @@ class TestChroTel(TestCase):
cls.settings = get_settings("chrotel")
def test_chrotel_importer(self):
with patch('argparse.ArgumentParser.parse_args',
return_value=Namespace(database='sdc_test', error_dir='/dat/schaffer/projects/sdc_importer/tests',
folder='/dat/sdc/testing_data_for_importer/chrotel/lev1.0/fits/2018/11/30',
force_import=True, server='localhost:27017')):
main()
mongo_client = ChrotelMongoClient('localhost:27017', 'foo')
mongo_client.ignore_version_mismatch = True
dummy_id = ObjectId('5dad6165636b4a1aa71eb48c')
with patch.object(mongo_client, 'write_to_gridfs', return_value=dummy_id) as gfs_patched:
with patch.object(mongo_client, 'write_to_collection', return_value=dummy_id) as coll_patched:
with patch.object(mongo_client.obstarget, 'find_one',
return_value={'movie_id': dummy_id}):
mongo_client.import_files(_testing_data_folder)
print(coll_patched, gfs_patched)
mongo_client.close()
def test_header_conversion(self):
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment