Exemple #1
0
class MicrobenchmarkRestFactory(Factory):
    class Meta:
        model = MicrobenchmarkRest
    metadata = generate_dict_factory(MetadataFactory)()
    timestamp = Faker('date_time')
    test_suite = Faker('word')
    test_name = Faker('word')
    parameters = generate_dict_factory(MicrobenchmarkParametersFactory)()
    metrics = generate_dict_factory(MicrobenchmarkMetricsFactory)()
Exemple #2
0
class OLTPBenchRestFactory(Factory):
    class Meta:
        model = OLTPBenchRest

    metadata = generate_dict_factory(MetadataFactory)()
    timestamp = Faker('date_time')
    type = Faker('word')
    parameters = generate_dict_factory(OLTPBenchParametersFactory)()
    metrics = generate_dict_factory(OLTPBenchMetricsFactory)()
Exemple #3
0
 def test_deserialize_model_fields(self):
     for test_name, class_factory, class_serializer, excluded_fields in self.serializer_test_params:
         with self.subTest(msg="Deserialization with {} is valid".format(test_name)):
             ClassDictFactory = generate_dict_factory(class_factory)
             input = ClassDictFactory()
             serializer = class_serializer(data=input)
             self.assertTrue(serializer.is_valid(), msg=serializer.errors)
 def test_201_response(self):
     """
     Ensure that a valid request sends back a 201
     """
     ClassDictFactory = generate_dict_factory(ArtifactStatsRestFactory)
     input = ClassDictFactory()
     self.client.credentials(HTTP_AUTHORIZATION=self.credentials)
     response = self.client.post(self.url, data=input, format='json')
     self.assertEqual(response.status_code, 201)
 def test_201_response_smudge_time(self):
     """
     Ensure that a second request with the time is saved appropriately
     """
     ClassDictFactory = generate_dict_factory(ArtifactStatsRestFactory)
     input = ClassDictFactory()
     self.client.credentials(HTTP_AUTHORIZATION=self.credentials)
     self.client.post(self.url, data=input, format='json')
     response = self.client.post(self.url, data=input, format='json')
     self.assertEqual(response.status_code, 201)
class OLTPBenchMetricsFactory(Factory):
    class Meta:
        model = OLTPBenchMetrics

    throughput = Faker('pydecimal',
                       left_digits=9,
                       right_digits=15,
                       positive=True)
    latency = LatencyMetricsFactory().__dict__
    incremental_metrics = Faker(
        'random_elements',
        elements=(
            generate_dict_factory(IncrementalMetricsFactory)(),
            generate_dict_factory(IncrementalMetricsFactory)(),
            generate_dict_factory(IncrementalMetricsFactory)(),
            generate_dict_factory(IncrementalMetricsFactory)(),
            generate_dict_factory(IncrementalMetricsFactory)(),
        ),
        unique=True)
class ArtifactStatsRestFactory(Factory):
    class Meta:
        model = ArtifactStatsRest
    metadata = generate_dict_factory(MetadataFactory)()
    timestamp = Faker('date_time')
    metrics = Faker('pydict', value_types=[int, float, str, [], dict])