Exemplo n.º 1
0
 def test_create_experiment(self):
     project_uuid = uuid.uuid4().hex
     object = ExperimentConfig(name=faker.word(), project=project_uuid)
     httpretty.register_uri(httpretty.POST,
                            ProjectClient._build_url(
                                self.client.base_url,
                                ProjectClient.ENDPOINT, project_uuid,
                                'experiments'),
                            body=json.dumps(object.to_dict()),
                            content_type='application/json',
                            status=200)
     result = self.client.create_experiment(project_uuid, object)
     assert result.to_dict() == object.to_dict()
 def test_update_project(self):
     object = ExperimentConfig(faker.word())
     experiment_uuid = uuid.uuid4().hex
     httpretty.register_uri(httpretty.PATCH,
                            ExperimentClient._build_url(
                                self.client.base_url,
                                ExperimentClient.ENDPOINT, experiment_uuid),
                            body=json.dumps(object.to_dict()),
                            content_type='application/json',
                            status=200)
     result = self.client.update_experiment(experiment_uuid,
                                            {'name': 'new'})
     assert result.to_dict() == object.to_dict()
Exemplo n.º 3
0
 def test_update_project(self):
     object = ExperimentConfig(config={})
     httpretty.register_uri(httpretty.PATCH,
                            ExperimentClient._build_url(
                                self.client.base_url,
                                ExperimentClient.ENDPOINT, 'username',
                                'project_name', 'experiments', 1),
                            body=json.dumps(object.to_dict()),
                            content_type='application/json',
                            status=200)
     result = self.client.update_experiment('username', 'project_name', 1,
                                            {'name': 'new'})
     assert result.to_dict() == object.to_dict()
 def test_stop_experiment(self):
     object = ExperimentConfig(name=faker.word())
     experiment_uuid = uuid.uuid4().hex
     httpretty.register_uri(httpretty.POST,
                            ExperimentClient._build_url(
                                self.client.base_url,
                                ExperimentClient.ENDPOINT, experiment_uuid,
                                'stop'),
                            body=json.dumps(object.to_dict()),
                            content_type='application/json',
                            status=200)
     result = self.client.stop(experiment_uuid)
     assert result.to_dict() == object.to_dict()