Exemplo n.º 1
0
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()
        cls.export_profile = fixtures.create_export_profile()

        cls.listing1 = ListingFactory(is_exportable=True, reviews=3)
        cls.listing2 = ListingFactory(is_exportable=True, reviews=2)
        cls.listing3 = ListingFactory(is_exportable=True, reviews=1)
        cls.listing4 = ListingFactory(is_exportable=True, reviews=2)
        cls.listing5 = ListingFactory(is_exportable=False, reviews=1)
        cls.listing6 = ListingFactory(is_exportable=True, is_private=True)
        cls.listings = [
            cls.listing1, cls.listing2, cls.listing3, cls.listing4,
            cls.listing5, cls.listing6
        ]

        cls.contacts = ContactFactory.create_batch(3)
        cls.categories = CategoryFactory.create_batch(3)
        cls.intents = IntentFactory.create_batch(2)
        cls.tags = TagFactory.create_batch(3)

        for listing in cls.listings[0:2]:
            listing.owners.add(cls.org_steward_profile)
            listing.contacts.add(*cls.contacts[0:1])
            listing.categories.add(*cls.categories[0:2])
            listing.tags.add(cls.tags[0])

        for listing in cls.listings[1:3]:
            listing.tags.add(cls.tags[1])

        for listing in cls.listings[2:5]:
            listing.owners.add(cls.user_profile)
            listing.contacts.add(cls.contacts[2])
            listing.categories.add(*cls.categories[1:3])
            listing.tags.add(cls.tags[2])

        for listing in cls.listings:
            listing.intents.add(*cls.intents)

        cls.activities = ListingActivityFactory.create_batch(
            3,
            listing=cls.listing1,
            author=cls.org_steward_profile,
            change_details=3)
        cls.rejection = ListingActivityFactory(listing=cls.listing1,
                                               author=cls.org_steward_profile,
                                               action=ListingActivity.REJECTED,
                                               change_details=1)

        cls.listing1.last_activity = cls.activities[2]
        cls.listing1.current_rejection = cls.rejection
        cls.listing1.save()

        DocUrlFactory.create_batch(3, listing=cls.listing2)

        ScreenshotFactory.create_batch(3, listing=cls.listing4)

        cls.listing3.required_listings = cls.listing1
        cls.listing3.save()
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.custom_field_type1 = fixtures.create_custom_field_type(
            "Type 1", "type 1", "application/json")
        cls.custom_field1 = fixtures.create_custom_field(
            cls.custom_field_type1, "Custom Field 1", "Field 1")
        cls.custom_field2 = fixtures.create_custom_field(
            cls.custom_field_type1, "Custom Field 2", "Field 2")
        cls.custom_field3 = fixtures.create_custom_field(
            cls.custom_field_type1, "Custom Field 3", "Field 3")

        cls.agency = fixtures.create_agency('Agency 1', 'Agency 1')

        cls.listing1 = fixtures.create_minimal_listing("Min Listing",
                                                       "UNCLASSIFIED",
                                                       cls.agency)
        cls.field_value1 = fixtures.create_custom_field_value(
            cls.listing1, cls.custom_field2, "Field Value 1")
        cls.field_value2 = fixtures.create_custom_field_value(
            cls.listing1, cls.custom_field2, "Field Value 3")
        cls.listing1.save()

        cls.listing1_fields = [cls.field_value1, cls.field_value2]
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.type1 = fixtures.create_custom_field_type("Type 1", "Type 1", "text/html")
        cls.type2 = fixtures.create_custom_field_type("JSON Type", "JSON", "application/json")
        cls.type3 = fixtures.create_custom_field_type("Type 3", "Type 3", "text/html")

        cls.types_ordered = [cls.type2, cls.type1, cls.type3]
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.image_type = fixtures.create_image_type('large_icon')
        cls.image = fixtures.create_image(cls.image_type)

        cls.store1 = fixtures.create_affiliated_store("Store 1", "http://www.store1a.test", cls.image, True)
        cls.store2 = fixtures.create_affiliated_store("Store 2", "http://www.store2.test", cls.image, True)
        cls.store3 = fixtures.create_affiliated_store("Store 3", "http://www.store3.test", cls.image, True)
        cls.all_stores = [cls.store1, cls.store2, cls.store3]
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.type1 = fixtures.create_custom_field_type("Type 1", "Type 1",
                                                      "text/html")
        cls.type2 = fixtures.create_custom_field_type("JSON Type", "JSON",
                                                      "application/json")

        cls.field1 = fixtures.create_custom_field(cls.type1, 'Custom Field 1',
                                                  'Custom Field Label 1')
        cls.field2 = fixtures.create_custom_field(cls.type1, 'Custom Field 2',
                                                  'Custom Field Label 2')
        cls.field3 = fixtures.create_custom_field(cls.type1, 'Custom Field 2',
                                                  'Custom Field Label 2')

        cls.fields_ordered = [cls.field1, cls.field2, cls.field3]
    def setUpTestData(cls):
        """
        Set up test data for the whole TestCase (only run once for the TestCase)
        """
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.custom_field_type1 = fixtures.create_custom_field_type(
            'Type 1', 'Type 1', 'application/json')
        cls.custom_field1 = fixtures.create_custom_field(
            cls.custom_field_type1, 'Custom Field', 'Custom Field')

        cls.listing_type1 = fixtures.create_listing_type(
            "Listing Type 1", "Description 1")
        cls.listing_type2 = fixtures.create_listing_type(
            "Listing Type 2", "Description 2")
        cls.listing_type3 = fixtures.create_listing_type(
            "Listing Type 3", "Description 3")

        cls.listing_type1.custom_fields.add(cls.custom_field1)
        cls.listing_types_ordered = [
            cls.listing_type1, cls.listing_type2, cls.listing_type3
        ]
Exemplo n.º 7
0
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.image_type = fixtures.create_image_type('large_icon')
        cls.image = fixtures.create_image(cls.image_type)

        cls.store1 = fixtures.create_affiliated_store(
            "Store 1", "http://www.store1a.test", cls.image, True)
        cls.store2 = fixtures.create_affiliated_store(
            "Store 2", "http://www.store2.test", cls.image, True)

        cls.task1 = fixtures.create_import_task("Task 1", "Entire", cls.store1)
        cls.task2 = fixtures.create_import_task("Task 2", "Entire", cls.store2)

        cls.task1_result1 = fixtures.create_import_task_result(
            cls.task1, "Result 1-1", "Pass")
        cls.task1_result2 = fixtures.create_import_task_result(
            cls.task1, "Result 1-2", "Fail")
        cls.task2_result1 = fixtures.create_import_task_result(
            cls.task2, "Result 2-1", "Pass")

        cls.task1_results = [cls.task1_result1, cls.task1_result2]
    def setUpTestData(cls):
        cls.aml_steward_profile = fixtures.create_steward()
        cls.org_steward_profile = fixtures.create_org_steward()
        cls.user_profile = fixtures.create_user_profile()

        cls.image_type = fixtures.create_image_type('large_icon')
        cls.image = fixtures.create_image(cls.image_type)

        cls.store1 = fixtures.create_affiliated_store(
            "Store 1", "http://www.store1a.test", cls.image, True)
        cls.store2 = fixtures.create_affiliated_store(
            "Store 2", "http://www.store2.test", cls.image, True)
        cls.store3 = fixtures.create_affiliated_store(
            "Store 3", "http://www.store3.test", cls.image, True)

        cls.import_task1 = fixtures.create_import_task("Task 1", "Entire",
                                                       cls.store1)
        cls.import_task2 = fixtures.create_import_task("ABC Task 2", "Entire",
                                                       cls.store2)
        cls.import_task3 = fixtures.create_import_task("Task 3", "Entire",
                                                       cls.store3)
        cls.import_tasks_ordered = [
            cls.import_task2, cls.import_task1, cls.import_task3
        ]