Exemple #1
0
class TestDataValidation(TransactionTestCase):
    fixtures = ['init_panda.json', 'test_users.json']

    def setUp(self):
        self.validator = DataValidation()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)

    def test_required_fields(self):
        bundle = Bundle(data={})

        errors = self.validator.is_valid(bundle, None)

        self.assertIn('data', errors)
        self.assertIn('required', errors['data'][0])

    def test_external_id_valid(self):
        bundle = Bundle(data={ 'external_id': 'a1_-' })
        errors = self.validator.is_valid(bundle, None)

        self.assertNotIn('external_id', errors)

    def test_external_id_invalid(self):
        bundle = Bundle(data={ 'external_id': 'no spaces' })
        errors = self.validator.is_valid(bundle, None)

        self.assertIn('external_id', errors)
Exemple #2
0
class TestDataValidation(TransactionTestCase):
    fixtures = ["init_panda.json"]

    def setUp(self):
        self.validator = DataValidation()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)

    def test_required_fields(self):
        bundle = Bundle(data={})

        errors = self.validator.is_valid(bundle, None)

        self.assertIn("data", errors)
        self.assertIn("required", errors["data"][0])

    def test_external_id_valid(self):
        bundle = Bundle(data={"external_id": "a1_-"})
        errors = self.validator.is_valid(bundle, None)

        self.assertNotIn("external_id", errors)

    def test_external_id_invalid(self):
        bundle = Bundle(data={"external_id": "no spaces"})
        errors = self.validator.is_valid(bundle, None)

        self.assertIn("external_id", errors)
Exemple #3
0
class TestDataValidation(TransactionTestCase):
    fixtures = ['init_panda.json', 'test_users.json']

    def setUp(self):
        self.validator = DataValidation()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)

    def test_required_fields(self):
        bundle = Bundle(data={})

        errors = self.validator.is_valid(bundle, None)

        self.assertIn('data', errors)
        self.assertIn('required', errors['data'][0])

    def test_external_id_valid(self):
        bundle = Bundle(data={ 'external_id': 'a1_-' })
        errors = self.validator.is_valid(bundle, None)

        self.assertNotIn('external_id', errors)

    def test_external_id_invalid(self):
        bundle = Bundle(data={ 'external_id': 'no spaces' })
        errors = self.validator.is_valid(bundle, None)

        self.assertIn('external_id', errors)
Exemple #4
0
    def setUp(self):
        self.validator = DataValidation()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)
Exemple #5
0
    def setUp(self):
        self.validator = DataValidation()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)