зеркало из
1
0
Форкнуть 0

integration tests for TableService

This commit is contained in:
Troy Howard 2012-10-17 03:01:02 -07:00
Родитель 422924320b
Коммит 91e8998408
3 изменённых файлов: 72 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,33 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#--------------------------------------------------------------------------
require "integration/test_helper"
require "azure/storage/table/table_service"
require "azure/core/http/http_error"
describe "Create a table" do
subject { Azure::Storage::Table::TableService.new }
let(:table_name){ TableNameHelper.name }
after { TableNameHelper.clean }
it "creates a table with a valid name" do
assert subject.create_table(table_name)
end
it "errors on an invalid table name" do
assert_raises(Azure::Core::Http::HTTPError) do
subject.create_table "this_table/cannot-exist!"
end
end
end

Просмотреть файл

@ -0,0 +1,35 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#--------------------------------------------------------------------------
require "integration/test_helper"
require "azure/storage/table/table_service"
require "azure/core/http/http_error"
describe "Get a table" do
subject { Azure::Storage::Table::TableService.new }
let(:table_name){ TableNameHelper.name }
before { subject.create_table table_name }
after { TableNameHelper.clean }
it "gets the last updated time of a valid table" do
result = subject.get_table table_name
result.must_be_kind_of Time
end
it "errors on an invalid table" do
assert_raises(Azure::Core::Http::HTTPError) do
subject.get_table "this_table/cannot-exist!"
end
end
end

Просмотреть файл

@ -32,10 +32,10 @@ class NameGenerator
end
end
# TableNameHelper = NameGenerator.new do |name|
# table = Azure::Tables::Table.new(name)
# Azure::Tables.delete(table)
# end
TableNameHelper = NameGenerator.new do |name|
svc = Azure::Storage::Table::TableService.new
svc.delete_table name
end
# ContainerNameHelper = NameGenerator.new do |name|
# container = Azure::Blobs::Container.new(name)