def test_validate_source_dict_mixed_invalid_2(self):
        to_test = DataMoverServices(None, None)

        source = []

        valid, reason = to_test._validate_source_dict(source)

        self.assertFalse(valid)
        self.assertEqual(REASON_INVALID_PARAMS_1S.format('no sources selected'), reason)
    def test_validate_source_dict_invalid_swift_url_3(self):
        to_test = DataMoverServices(None, None)

        file_1 = 'swift+http://nectar//'
        source = [file_1]

        valid, reason = to_test._validate_source_dict(source)

        self.assertFalse(valid)
        self.assertEqual(REASON_INVALID_SWIFT_URL.format("source", "'%s'" %file_1), reason)
    def test_validate_source_dict_mixed_invalid_1(self):
        to_test = DataMoverServices(None, None)

        file_1 = 'scp://visualiser/usr/local/data/occurrence/koalas.png'
        file_2 = [file_1]
        source = [file_2]

        valid, reason = to_test._validate_source_dict(source)

        self.assertFalse(valid)
        self.assertEqual(REASON_UNKNOWN_SOURCE_TYPE_1S.format("['scp://visualiser/usr/local/data/occurrence/koalas.png']"), reason)
    def test_multiple_ALA_in_mixed_source(self):
        to_test = DataMoverServices(None, None)

        file_1 = 'ala://ala?lsid=urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae'
        file_2 = 'scp://visualiser/usr/local/data/occurrence/koalas.png'
        file_3 = 'http://www.intersect.org.au/dingos.csv'
        file_4 = 'ala://ala?lsid=urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae'
        source = [file_1, file_2, file_3, file_4]

        valid, reason = to_test._validate_source_dict(source)

        self.assertFalse(valid)
        self.assertEqual('Too many ALA jobs. Mixed sources can only contain a maximum of one ALA job.', reason)
    def test_validate_source_dict_mixed(self):
        to_test = DataMoverServices(None, None)

        file1 = 'scp://visualiser/usr/local/data/occurrence/koalas.csv'
        file2 = 'scp://visualiser/usr/local/data/occurrence/koalas.png'
        file3 = 'http://www.intersect.org.au/dingos.csv'
        file4 = 'scp://host_blah/usr/local/data/occurrence/dingos.png'
        file5 = 'swift+http://nectar/container1/path/to/file.txt'
        source = [file1, file2, file3, file4, file5]

        valid, reason = to_test._validate_source_dict(source)

        self.assertTrue(valid)
        self.assertEqual('', reason)