예제 #1
0
 def test_versions_index(self):
     req = fakes.HTTPRequest.blank('/')
     req.method = 'GET'
     req.content_type = 'application/json'
     resource = versions.Versions()
     result = resource.dispatch(resource.index, req, {})
     ids = [v['id'] for v in result['versions']]
     self.assertEqual(set(['v1.0', 'v1.0']), set(ids))
예제 #2
0
 def test_versions_index_disable_v1(self):
     self.flags(enable_v1_api=False)
     req = fakes.HTTPRequest.blank('/')
     req.method = 'GET'
     req.content_type = 'application/json'
     resource = versions.Versions()
     result = resource.dispatch(resource.index, req, {})
     ids = [v['id'] for v in result['versions']]
     self.assertEqual(set([]), set(ids))
예제 #3
0
def test_versions_page():

    buttons = mock_create_button()

    sut = versions.Versions()
    sut.set_cell_text = lambda x, y: (None, None)

    sut.tableview_cell_for_row(None, None, None)

    assert set(buttons) == set(["epics", "issues"])
예제 #4
0
 def test_get_version_list(self):
     req = webob.Request.blank('/', base_url='http://127.0.0.1:8760/')
     req.accept = 'application/json'
     res = versions.Versions().index(req)
     results = res['versions']
     expected = [
         {
             'id': 'v1.0',
             'status': 'SUPPORTED',
             'updated': '2014-06-28T12:20:21Z',
             'links': [{'rel': 'self',
                        'href': 'http://127.0.0.1:8760/v1/'}],
         },
     ]
     self.assertEqual(expected, results)
예제 #5
0
def wsgi_app(inner_app_v1=None, fake_auth=True, fake_auth_context=None,
             use_no_auth=False, ext_mgr=None):

    if fake_auth:
        if fake_auth_context is not None:
            ctxt = fake_auth_context
        else:
            ctxt = context.RequestContext('fake', 'fake', auth_token=True)
        api_v1 = fault.FaultWrapper(auth.InjectContext(ctxt,
                                                       inner_app_v1))

    mapper = urlmap.URLMap()
    mapper['/v1'] = api_v1
    mapper['/'] = fault.FaultWrapper(versions.Versions())
    return mapper
예제 #6
0
 def vtyper(self):
     """
     Calls the necessary methods in the appropriate order
     """
     import vtyperesults
     import createObject
     # Create a sample object
     self.runmetadata = createObject.ObjectCreation(self)
     # Run the baiting, mapping, sorting, and parsing method. Include a cutoff of 1.0 and a match bonus of 5
     custom = customtargets.Custom(self, 'vtyper', 1.0, 5)
     custom.targets()
     # Create the report
     vtyperesults.VtypeResults(self, 'vtyper')
     # Get the versions of the software used
     versions.Versions(self)
     # Print the metadata to file
     metadataprinter.MetadataPrinter(self)
예제 #7
0
 def test_versions_action_args_multi(self):
     request_environment = {'PATH_INFO': '/fake/path'}
     resource = versions.Versions()
     result = resource.get_action_args(request_environment)
     self.assertEqual('multi', result['action'])
예제 #8
0
 def test_versions_action_args_index(self):
     request_environment = {'PATH_INFO': '/'}
     resource = versions.Versions()
     result = resource.get_action_args(request_environment)
     self.assertEqual('index', result['action'])