Exemple #1
0
    def test_new_presample(self):
        presample = Sample(resolwe=self.res, presample=True)
        self.remove.append(presample)

        presample.name = 'my-presample'
        presample.save()

        response = presample.api(presample.id).get()
        unsupported = set(presample.fields()).symmetric_difference(
            response.keys())
        self.assertEqual(len(unsupported),
                         0,
                         msg="Some fields are not supported: {}".format(
                             ', '.join(unsupported)))

        presample.slug = 'my-test'
        presample.save()

        response = presample.api(presample.id).get()
        self.assertEqual(response['slug'], presample.slug)
Exemple #2
0
    def test_new_sample(self):
        sample = Sample(resolwe=self.res)
        self.remove.append(sample)

        sample.name = 'my-sample'
        sample.save()

        response = sample.api(sample.id).get()
        unsupported = set(sample.fields()).symmetric_difference(
            response.keys())

        self.assertEqual(
            len(unsupported),
            1,  # presample field is not supported in Sample
            msg="Some fields are not supported: {}".format(
                ', '.join(unsupported)))

        sample.slug = 'my-test'
        sample.save()

        response = sample.api(sample.id).get()
        self.assertEqual(response['slug'], sample.slug)