def test_altitude_not_in_gathering_if_not_in_file(self): document.delete_all() _create_points_from_ecotone(self, "/Ecotones_gps_pos_doc_create_test2.csv") documents = document.find() result = len(documents[0].gatherings[0].geometry) == 2 self.assertEquals(result, True)
def test_gathering_publicity_remains_unchanged_after_unite(self): document.delete_all() _create_points_from_ecotone(self, "/Ecotones_gps_pos_gathering_duplicate_test.csv", "01-01-1000, 00-00-00") documents = document.find()[0] documents.gatherings[0].publicityRestrictions = "MZ.publicityRestrictionsPublic" documents.update() _create_points_from_ecotone(self, "/Ecotones_gps_pos_gathering_duplicate_test.csv", "24-11-2015, 00-00-00") self.assertEquals(document.find()[0].gatherings[0].publicityRestrictions, "MZ.publicityRestrictionsPublic")
def test_byholm_data_goes_to_lajiStore_succesfully(self): document.delete_all() path = settings.OTHER_ROOT + "/byholm_test.txt" file = open(path, "rb") entries = prepare_file(file, self.byholm_parser, "1010") create_points(entries, self.byholm_parser, "byholm_test.txt", datetime.datetime.now().strftime("%d-%m-%Y, %H:%M:%S")) documents = document.find() self.assertEqual(len(documents), 1) self.assertEqual(len(documents[0].gatherings), 5)
def test_altitude_in_gathering(self): document.delete_all() _create_points_from_ecotone(self, "/Ecotones_gps_pos_doc_create_test.csv") for attempt in range(3): documents = document.find() result = documents[0].gatherings[0].geometry[2] == 1 if result: break time.sleep(4) self.assertEquals(result, True)
def test_merge_and_delete_if_three_documents_found_for_same_device(self): document.delete_all() device.delete_all() _create_points_from_ecotone(self, "/Ecotones_gps_pos_test.csv") dev = device.find()[0] gatherings = [gathering.Gathering("2015-09-15T08:00:00+03:00", [68.93023632, 23.19298104])] dict = { "deviceID": dev.id, "dateCreated": "2015-09-14T15:29:28+03:00", "dateEdited": "2015-09-14T15:29:28+03:00", "gatherings": gatherings } document.create(**dict) document.create(**dict) document.create(**dict) time.sleep(2) self.assertEqual(len(document.find()), 4) _create_points_from_ecotone(self, "/Ecotones_gps_pos_test.csv") time.sleep(2) self.assertEqual(len(document.find()),1)
def tearDown(self): document.delete_all() self.ecotone_parser.delete() self.byholm_parser.delete()