def test_compare_new_old_record(self): # the difference here is that our record now has the updated column record = self.idnum[0] write_to_fomo(record, self.id_cursor, 'api') old_record = self.id_cursor.find_one({'id': record}) write_to_fomo(record, self.id_cursor, 'api') new_record = self.id_cursor.find_one({'id': record}) self.assertGreater(new_record['updated'], old_record['updated'])
def test_write_from_api_exists(self): record = self.idnum[0] # here we expect the updated column to change result = write_to_fomo(record, self.id_cursor, 'api') self.assertTrue(result.acknowledged)
def test_write_from_file_not_exists(self): record = 2222 self.assertIsNone(exists_on_fomo(record, self.id_cursor)) write_to_fomo(record, self.id_cursor, 'file') self.assertIsNotNone(exists_on_fomo(record, self.id_cursor))
def test_write_from_file_exists(self): record = self.idnum[0] # Since this record exists on the database but not the file, it gets deleted write_to_fomo(record, self.id_cursor, 'file') self.assertIsNone(exists_on_fomo(record, self.id_cursor))
def setUp(self): for record in self.idnum: write_to_fomo(record, self.id_cursor, 'file')