def test_index_must_be_unique(self): Company.load_data_from_file("../../resources/companies.json") before_count = Company.objects.count() Company.load_data_from_file("../../resources/companies.json") after_count = Company.objects.count() self.assertEqual(after_count, before_count)
def handle(self, *args, **options): if not options.get("companies") or not options.get("people"): self.stdout.write(self.usage) return # First load companies for elem in options["companies"]: Company.load_data_from_file(elem) # Then load people for elem in options["people"]: load_data_from_file(elem)
def test_load_data_from_file(self): before_count = Company.objects.count() Company.load_data_from_file("../../resources/companies.json") after_count = Company.objects.count() self.assertGreater(after_count, before_count)
def handle(self, *args, **options): for filename in options["filenames"]: Company.load_data_from_file(filename)