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')
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')
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_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')
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')
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')
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')
def setUp(self): super(VersionTestCase, self).setUp() self.version = Version(id, status, base_url, updated) self.assertIsNotNone(self.version, 'Version instance was None')