Example #1
0
    def test_update_bay_name_for_existing_bay(self):
        first_model = datagen.valid_bay_data(baymodel_id=self.baymodel.uuid,
                                             name='test')
        _, old_model = self._create_bay(first_model)

        patch_model = datagen.bay_name_patch_data()
        self.assertRaises(exceptions.BadRequest, self.bay_client.patch_bay,
                          old_model.uuid, patch_model)
Example #2
0
    def test_update_bay_name_for_existing_bay(self):
        first_model = datagen.valid_bay_data(baymodel_id=self.baymodel.uuid,
                                             name='test')
        _, old_model = self._create_bay(first_model)

        patch_model = datagen.bay_name_patch_data()
        self.assertRaises(
            exceptions.BadRequest,
            self.bay_client.patch_bay,
            old_model.uuid, patch_model)
Example #3
0
    def test_create_list_and_delete_bays(self):
        gen_model = datagen.valid_bay_data(baymodel_id=self.baymodel.uuid,
                                           node_count=1)

        # test bay create
        _, temp_model = self._create_bay(gen_model)

        # test bay list
        resp, model = self.bay_client.list_bays()
        self.assertEqual(200, resp.status)
        self.assertGreater(len(model.bays), 0)
        self.assertIn(temp_model.uuid, list([x['uuid'] for x in model.bays]))

        # test invalid bay update
        patch_model = datagen.bay_name_patch_data()
        self.assertRaises(exceptions.BadRequest, self.bay_client.patch_bay,
                          temp_model.uuid, patch_model)

        # test bay delete
        self._delete_bay(temp_model.uuid)
        self.bays.remove(temp_model.uuid)
Example #4
0
    def test_create_list_and_delete_bays(self):
        gen_model = datagen.valid_bay_data(
            baymodel_id=self.baymodel.uuid, node_count=1)

        # test bay create
        _, temp_model = self._create_bay(gen_model)

        # test bay list
        resp, model = self.bay_client.list_bays()
        self.assertEqual(200, resp.status)
        self.assertGreater(len(model.bays), 0)
        self.assertIn(
            temp_model.uuid, list([x['uuid'] for x in model.bays]))

        # test invalid bay update
        patch_model = datagen.bay_name_patch_data()
        self.assertRaises(
            exceptions.BadRequest,
            self.bay_client.patch_bay,
            temp_model.uuid, patch_model)

        # test bay delete
        self._delete_bay(temp_model.uuid)
        self.bays.remove(temp_model.uuid)
Example #5
0
    def test_update_bay_for_nonexisting_bay(self):
        patch_model = datagen.bay_name_patch_data()

        self.assertRaises(
            exceptions.NotFound,
            self.bay_client.patch_bay, 'fooo', patch_model)
Example #6
0
    def test_update_bay_for_nonexisting_bay(self):
        patch_model = datagen.bay_name_patch_data()

        self.assertRaises(exceptions.NotFound, self.bay_client.patch_bay,
                          'fooo', patch_model)