Commit eb76a235 authored by Morten Knutsen's avatar Morten Knutsen

Move old files as is from nova_portal@bd3c11515a25f6bd4dd5071b1a660a72a7c4d5db.

This diff is collapsed.
# encoding: utf-8
from iaas_portal import odata
import uuid
class TestOData(object):
def setup(self):
def teardown(self):
def test_ns_split(self):
""" Test splitting tag and namespace, normal flow """
tag = "{}mytag"
namespace, tag = odata.namespace_split(tag)
assert namespace == ""
assert tag == "mytag"
def test_ns_split_no_namespace(self):
""" Test splitting tag and namespace when no namespace is provided """
tag = "mytag"
namespace, res_tag = odata.namespace_split(tag)
assert namespace == ""
assert res_tag == tag
def test_ns(self):
""" test constructing namespaced tag names """
assert odata.ns("b", "mytag") == "{}mytag"
assert odata.ns("atom", "mytag2") == "{}mytag2"
assert odata.ns("ds", "sometag") == "{}sometag"
assert odata.ns("m", "mytag") == "{}mytag"
def test_type_encode_argvalue(self):
uuid_string = '00010203-0405-0607-0809-0a0b0c0d0e0f'
guid = uuid.UUID(uuid_string)
assert odata.type_encode_argvalue(guid) == "guid'" + uuid_string + "'"
assert odata.type_encode_argvalue("mystring") == "'mystring'"
# assert odata.type_encode_argvalue(u"blåbærsyltetøy") = u"'blåbærsyltetøy'"
assert odata.type_encode_argvalue(123) == 123
class TestODataClient(object):
def setup(self):
self.client = odata.Client("http://someurl", "myusername", "mytopsecretpassword")
def teardown(self):
def test_format_url(self):
""" Test the format url call """
assert self.client._format_url("foo") == "http://someurl/foo"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment