def test_smudge_time_save(self): oltpbench_result_1 = OLTPBenchDBFactory() oltpbench_result_1.save() oltpbench_result_2 = OLTPBenchDBFactory() oltpbench_result_2.time = oltpbench_result_1.time oltpbench_result_2.save() all_db_objects = OLTPBenchResult.objects.all() self.assertEqual(len(all_db_objects), 2)
def test_smudge_timestamp(self): existing_db_entry = OLTPBenchDBFactory() existing_db_entry.save() factory = OLTPBenchRestFactory() factory.timestamp = parse_datetime(existing_db_entry.time) input = factory.convert_to_db_json() serializer = OLTPBenchResultSerializer(data=input) serializer.smudge_timestamp() self.assertNotEqual(serializer.initial_data['time'], parse_datetime(existing_db_entry.time))
def test_save(self): oltpbench_result = OLTPBenchDBFactory() oltpbench_result.save() all_db_objects = OLTPBenchResult.objects.all() self.assertEqual(len(all_db_objects), 1)