def test_approve_addons_get_files(use_case): """Files that need to get approved are returned in the list. Use cases are quadruples taken from the "use_case" fixture above. """ addon, file1, file2, review_type = use_case assert approve_addons.get_files([addon.guid]) == [file1, file2]
def test_approve_addons_get_files_bad_guid(): """An add-on with another guid doesn't get approved.""" addon1 = addon_factory(status=amo.STATUS_NOMINATED, guid='foo') addon1_file = addon1.find_latest_version().files.get() addon1_file.update(status=amo.STATUS_AWAITING_REVIEW) # Create another add-on that we won't get the files for. addon2 = addon_factory(status=amo.STATUS_NOMINATED, guid='bar') addon2_file = addon2.find_latest_version().files.get() addon2_file.update(status=amo.STATUS_AWAITING_REVIEW) # There's only the addon1's file returned, no other. assert approve_addons.get_files(['foo']) == [addon1_file]
def test_approve_addons_get_files_bad_guid(): """An add-on with another guid doesn't get approved.""" addon1 = amo.tests.addon_factory(status=amo.STATUS_UNREVIEWED, guid='foo') addon1_file = addon1.latest_version.files.get() addon1_file.update(status=amo.STATUS_UNREVIEWED) # Create another add-on that we won't get the files for. addon2 = amo.tests.addon_factory(status=amo.STATUS_UNREVIEWED, guid='bar') addon2_file = addon2.latest_version.files.get() addon2_file.update(status=amo.STATUS_UNREVIEWED) # There's only the addon1's file returned, no other. assert approve_addons.get_files(['foo']) == [addon1_file]
def test_approve_addons_get_files_bad_guid(): """An add-on with another guid doesn't get approved.""" addon1 = addon_factory(status=amo.STATUS_NOMINATED, guid='foo') addon1_file = addon1.find_latest_version( amo.RELEASE_CHANNEL_LISTED).files.get() addon1_file.update(status=amo.STATUS_AWAITING_REVIEW) # Create another add-on that we won't get the files for. addon2 = addon_factory(status=amo.STATUS_NOMINATED, guid='bar') addon2_file = addon2.find_latest_version( amo.RELEASE_CHANNEL_LISTED).files.get() addon2_file.update(status=amo.STATUS_AWAITING_REVIEW) # There's only the addon1's file returned, no other. assert approve_addons.get_files(['foo']) == [addon1_file]
def test_approve_addons_get_files_incomplete(): """An incomplete add-on can't be approved.""" addon = addon_factory(status=amo.STATUS_NULL) assert approve_addons.get_files([addon.guid]) == []