コード例 #1
0
ファイル: test_versions.py プロジェクト: arisu1000/trove
class VersionTestCase(trove_testtools.TestCase):

    def setUp(self):
        super(VersionTestCase, self).setUp()

        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version,
                             'Version instance was None')

    def test_url_no_trailing_slash(self):
        url = self.version.url()
        self.assertIsNotNone(url, 'Version url was None')
        self.assertEqual(BASE_URL + '/', url,
                         'Base url value was incorrect')

    def test_url_with_trailing_slash(self):
        self.version.base_url = 'http://localhost/'
        url = self.version.url()
        self.assertEqual(BASE_URL + '/', url,
                         'Base url value was incorrect')
コード例 #2
0
ファイル: test_versions.py プロジェクト: mlowery/trove
class VersionTestCase(testtools.TestCase):

    def setUp(self):
        super(VersionTestCase, self).setUp()

        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version,
                             'Version instance was None')

    def test_url_no_trailing_slash(self):
        url = self.version.url()
        self.assertIsNotNone(url, 'Version url was None')
        self.assertEqual(BASE_URL + '/', url,
                         'Base url value was incorrect')

    def test_url_with_trailing_slash(self):
        self.version.base_url = 'http://localhost/'
        url = self.version.url()
        self.assertEqual(BASE_URL + '/', url,
                         'Base url value was incorrect')
コード例 #3
0
ファイル: test_versions.py プロジェクト: vdialani/trove
    def setUp(self):
        super(VersionTestCase, self).setUp()

        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version, 'Version instance was None')
コード例 #4
0
ファイル: test_versions.py プロジェクト: luccacabra/trove
    def test_index_xml(self):
        request = Mock()
        result = self.controller.index(request)
        self.assertIsNotNone(result, 'Result was None')

        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']
        version = Version(id, status, base_url, updated)

        result._data = Mock()
        result._data.data_for_xml = lambda: {'versions': [version]}

        xml_data = result.data("application/xml")
        self.assertIsNotNone(xml_data, 'Result xml_data was None')

        versions = xml_data['versions']
        self.assertIsNotNone(versions, "Versions was None")
        self.assertTrue(len(versions) == 1, "Versions length was != 1")
        v = versions[0]

        self.assertEqual('v1.0', v.id, 'Version id is incorrect')
        self.assertEqual('CURRENT', v.status, 'Version status is incorrect')
        self.assertEqual('2012-08-01T00:00:00Z', v.updated,
                         'Version updated value is incorrect')
コード例 #5
0
ファイル: test_versions.py プロジェクト: arisu1000/trove
    def setUp(self):
        super(VersionTestCase, self).setUp()

        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version,
                             'Version instance was None')
コード例 #6
0
    def setUp(self):
        super(VersionDataViewTestCase, self).setUp()

        # get a version object first

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version, 'Version instance was None')

        # then create an instance of VersionDataView
        self.version_data_view = VersionDataView(self.version)
        self.assertIsNotNone(self.version_data_view,
                             'Version Data view instance was None')
コード例 #7
0
    def setUp(self):
        super(VersionsDataViewTestCase, self).setUp()

        # get a version object, put it in a list
        self.versions = []
        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version, 'Version instance was None')
        self.versions.append(self.version)

        # then create an instance of VersionsDataView
        self.versions_data_view = VersionsDataView(self.versions)
        self.assertIsNotNone(self.versions_data_view,
                             'Versions Data view instance was None')
コード例 #8
0
ファイル: test_versions.py プロジェクト: vdialani/trove
    def setUp(self):
        super(VersionDataViewTestCase, self).setUp()

        # get a version object first
        id = VERSIONS['1.0']['id']
        status = VERSIONS['1.0']['status']
        base_url = BASE_URL
        updated = VERSIONS['1.0']['updated']

        self.version = Version(id, status, base_url, updated)
        self.assertIsNotNone(self.version, 'Version instance was None')

        # then create an instance of VersionDataView
        self.version_data_view = VersionDataView(self.version)
        self.assertIsNotNone(self.version_data_view,
                             'Version Data view instance was None')
コード例 #9
0
 def setUp(self):
     super(VersionTestCase, self).setUp()
     self.version = Version(id, status, base_url, updated)
     self.assertIsNotNone(self.version, 'Version instance was None')