예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
 def handle(self, *args, **options):
     for filename in options["filenames"]:
         Company.load_data_from_file(filename)