예제 #1
0
    def make_new_collection(self, uniqueid):
        # create the collection
        data = {
            'id': (None, 'testid' + uniqueid),
            'version': (None, '1'),
            'name': (None, 'testcollection' + uniqueid),
            'description': (None, 'testdescription' + uniqueid),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml',
                 'rb'))
        }

        compare_post_request("submit",
                             data,
                             headers={"Accept": "text/plain"},
                             files=files,
                             test_name="generic_collection" + uniqueid)
        return data
예제 #2
0
    def test_make_public(self):
        data = self.make_new_collection("0")

        # get the view
        compare_get_request(
            "/user/:userId/:collectionId/:displayId/:version/makePublic",
            route_parameters=[
                "testuser", "testid0", "testid0_collection", "1"
            ])

        data['tabState'] = 'new'

        # make the collection public
        compare_post_request(
            "/user/:userId/:collectionId/:displayId/:version/makePublic",
            route_parameters=[
                "testuser", "testid0", "testid0_collection", "1"
            ],
            data=data)

        # try to delete the collection
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_get_request(
                "/public/:collectionId/:displayId/:version/removeCollection",
                route_parameters=["testid0", "testid0_collection", "1"],
                test_name='remove')
예제 #3
0
    def test_create_and_delete_collections(self):
        # create the collection
        data = {'id':(None, 'testid'),
                'version' : (None, '1'),
                'name' : (None, 'testcollection'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files, test_name = "submit_test_BBa")
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                                 files = files, test_name = "submit_already_in_use")
        
        self.create_collection2()

        compare_get_request("manage", test_name = "two_submissions")
        compare_get_request("submit", test_name = "two_submissions")
        

        # now remove the collections
        compare_get_request('/user/:userId/:collectionId/:displayId/:version/removeCollection', route_parameters = ["testuser", "testid", "testid_collection", "1"])
        compare_get_request('/user/:userId/:collectionId/:displayId/:version/removeCollection', route_parameters = ["testuser", "testid2", "testid2_collection", "1"], test_name = 'remove_second')

        compare_get_request("manage", test_name = "no_submissions")
예제 #4
0
    def test_create_and_delete_collections(self):
        # create the collection
        data = {'id':(None, 'testid'),
                'version' : (None, '1'),
                'name' : (None, 'testcollection'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files, test_name = "submit_test_BBa")
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                                 files = files, test_name = "submit_already_in_use")
        
        self.create_collection2()

        compare_get_request("manage", test_name = "two_submissions")
        compare_get_request("submit", test_name = "two_submissions")
        

        # now remove the collections
        compare_get_request('/user/:userId/:collectionId/:displayId/:version/removeCollection', route_parameters = ["testuser", "testid", "testid_collection", "1"])
        compare_get_request('/user/:userId/:collectionId/:displayId/:version/removeCollection', route_parameters = ["testuser", "testid2", "testid2_collection", "1"], test_name = 'remove_second')

        compare_get_request("manage", test_name = "no_submissions")
예제 #5
0
    def test_make_public(self):
        # create the collection
        data = {'id':(None, 'testid'),
                'version' : (None, '1'),
                'name' : (None, 'testcollection'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files, test_name = "submit_test_BBa_2")

        # get the view
        compare_get_request("/user/:userId/:collectionId/:displayId/:version/makePublic", route_parameters = ["testuser", "testid", "testid_collection", "1"])

        data['tabState'] = 'new'
        # make the collection public
        compare_post_request("/user/:userId/:collectionId/:displayId/:version/makePublic", route_parameters = ["testuser", "testid", "testid_collection", "1"], data = data)

        # try to delete the collection
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_get_request("/public/:collectionId/:displayId/:version/removeCollection", route_parameters = ["testid", "testid_collection", "1"], test_name = 'remove')
예제 #6
0
    def test_attachment(self):
        test_print("test_attachUrl_private starting")
        data={
                'url': 'synbiohub.org',
                'name' : 'synbiohubtestattachurl',
                'type' : 'test',
        }
#        compare_post_request("/user/:userId/:collectionId/:displayId/:version/attachUrl", route_parameters = ["testuser", "testid2", "testid2_collection", "1"], data = data, test_name = "test_attachURL_private")

        test_print("test_attachUrl_private completed")

        test_print("test_attach_private_collection starting")
        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml", open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}

        compare_post_request("user/:userId/:collectionId/:displayId/:version/attach",route_parameters = ["testuser", "testid2", "testid2_collection", "1"],data=data,  headers = {"Accept": "text/plain"}, files = files, test_name = "test_attach_to_private_collection2")

        test_print("test_attach_private_collection completed")

        test_print("test_attach_public_collection starting")
        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml", open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}

        compare_post_request("public/:collectionId/:displayId/:version/attach",route_parameters = ["testid1", "testid1_collection", "1"],data=data,  headers = {"Accept": "text/plain"}, files = files, test_name = "test_attach_to_public_collection")
        test_print("test_attach_private_collection completed")

#      test_print("test_attachUrl_public starting")
        data={
                'url': 'synbiohub.org',
                'name' : 'synbiohubtestattachurl',
                'type' : 'test',
        }
예제 #7
0
    def test_search(self):

        # test_searchQuery(self):
        test_print("test_search starting")
        compare_get_request("/search/:query?", route_parameters=["I0462"])
        test_print("test_search completed")

        # test_searchCount(self):
        test_print("test_searchCount starting")
        compare_get_request("/searchCount/:query?", route_parameters=["I0462"])
        test_print("test_searchCount completed")

        # test_advancedSearch(self):
        test_print("test_advancedSearch GET starting")
        compare_get_request("/advancedSearch")
        test_print("test_advancedSearch completed")

        # test advancedSerach post
        test_print("test_advancedSearch POST starting")
        data = {'description': 'BBa_I0462', 'adv': 'Search'}
        compare_post_request("/advancedSearch", data=data)

        test_print("test_advancedSearch completed")

        # test_rootCollections(self):
        test_print("test_rootCollections starting")
        compare_get_request("/rootCollections")
        test_print("test_rootCollections completed")

        # test_sparql(self):
        test_print("test_sparql starting")
        compare_get_request("/sparql", headers={"Accept": "text/html"})
        test_print("test_sparql completed")

        test_print("test_subcollections_public starting")
        compare_get_request(
            "/public/:collectionId/:displayId/:version/subCollections",
            route_parameters=["testid1", "testid1_collection", "1"],
            headers={"Accept": "text/html"})
        test_print("test_subcollections_public completed")

        # test_uses(self):
        #        test_print("test_uses starting")
        #        compare_get_request("user/:userId/:collectionId/:displayId/:version/uses", route_parameters = ["testuser","testid2", "BBa_B0015", "1"],headers = {"Accept": "text/html"})
        #       test_print("test_uses completed")

        test_print("test_subcollections_private starting")
        compare_get_request(
            "user/:userId/:collectionId/:displayId/:version/subCollections",
            route_parameters=[
                "testuser", "testid2", "testid2_collection", "1"
            ],
            headers={"Accept": "text/html"})
        test_print("test_subcollections_private completed")

        test_print("test_browse_get starting")
        compare_get_request("browse", headers={"Accept": "text/html"})
        test_print("test_browse_get completed")
예제 #8
0
    def test_create_id_missing(self):
        data = {'version' : (None, '1'),
                'name' : (None, 'testcollection'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                                 files = files, test_name = "missing_id")
예제 #9
0
    def create_collection2(self):
        data = {'id':(None, 'testid2'),
                'version' : (None, '1'),
                'name' : (None, 'testcollection2'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files,
                             test_name = "create_2")
예제 #10
0
    def create_collection(self, collectionname, sbol2filename):
        data = {'id':(None, 'testid_'+collectionname),
                'version' : (None, '1'),
                'name' : (None, collectionname),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/" + sbol2filename,
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/' + sbol2filename, 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files,
                             test_name = "create_collection_"+collectionname)
예제 #11
0
    def create_collection2(self):
        data = {'id':(None, 'testid2'),
                'version' : (None, '1'),
                'name' : (None, 'testcollection2'),
                'description':(None, 'testdescription'),
                'citations':(None, 'none'),
                'overwrite_merge':(None, '0')}

        files = {'file':("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
                                              open('./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml', 'rb'))}
        
        compare_post_request("submit", data, headers = {"Accept": "text/plain"},
                             files = files,
                             test_name = "create_2")
예제 #12
0
    def test_create_user_and_upload(self):
        # first, register a new user
        data = {'name' : 'dockertestuser',
                'email' : '*****@*****.**',
                'username' : 'dockertestuser',
                'password1' : 'test',
                'password2' : 'test'}

        compare_post_request('/register', data)

        # login as the user
        logininfo = {'email' : 'dockertestuser',
                     'password' : 'test'}
        login_with(logininfo)

        # now create a couple collections
        self.create_collection("memberAnnotations", "memberAnnotations.xml")
        self.create_collection("multipleCollections_no_Members", "multipleCollections_no_Members.xml")
        self.create_collection("sequence1", "sequence1.xml")
예제 #13
0
    def test_post(self):

        # fill in the form and submit with test info
        setup = {
            'userName': '******',
            'userFullName': 'Test User',
            'userEmail': '*****@*****.**',
            'userPassword': '******',
            'userPasswordConfirm': 'test',
            'instanceName': 'Test Synbiohub',
            'instanceURL': 'http://localhost:7777/',
            'uriPrefix': 'http://localhost:7777/',
            'color': '#D25627',
            'frontPageText': 'text',
            'virtuosoINI': '/etc/virtuoso-opensource-7/virtuoso.ini',
            'virtuosoDB': '/var/lib/virtuoso-opensource-7/db',
            'allowPublicSignup': 'true',
        }

        compare_post_request('setup', setup)
예제 #14
0
    def test_post(self):

        # fill in the form and submit with test info
        setup = {
            'userName' : 'testuser',
            'userFullName' : 'Test User',
            'userEmail': '*****@*****.**',
            'userPassword': '******',
            'userPasswordConfirm': 'test',
            'instanceName': 'Test Synbiohub',
            'instanceURL': 'http://localhost:7777/',
            'uriPrefix': 'http://localhost:7777/',
            'color': '#D25627',
            'frontPageText': 'text',
            'virtuosoINI': '/etc/virtuoso-opensource-7/virtuoso.ini',
            'virtuosoDB': '/var/lib/virtuoso-opensource-7/db',
            'allowPublicSignup': 'true',
        }

        compare_post_request('setup', setup)
예제 #15
0
    def test_create_user_and_upload(self):
        # first, register a new user
        data = {
            'name': 'dockertestuser',
            'email': '*****@*****.**',
            'username': '******',
            'password1': 'test',
            'password2': 'test'
        }

        compare_post_request('/register', data)

        # login as the user
        logininfo = {'email': 'dockertestuser', 'password': '******'}
        login_with(logininfo)

        # now create a couple collections
        self.create_collection("memberAnnotations", "memberAnnotations.xml")
        self.create_collection("multipleCollections_no_Members",
                               "multipleCollections_no_Members.xml")
        self.create_collection("sequence1", "sequence1.xml")
예제 #16
0
    def test_before_login(self):

        # test_get_main_page(self):
        test_print("test_get_main_page starting")
        compare_get_request("/")
        test_print("test_get_main_page completed")

        # test_get_login(self):
        test_print("test_get_login starting")
        compare_get_request("/login")
        test_print("test_get_login completed")

        # test_post_bad_login(self):
        test_print("test_post_bad_login starting")
        bad_login_info = {'email' : 'bademail',
                          'password' : 'test'}
        compare_post_request("/login", bad_login_info, test_name='bad_admin_login')
        test_print("test_post_bad_login completed")

        # test_no_username_login(self):
        test_print("test_no_username_login starting")
        no_email_info = {'password' : 'test'}
        compare_post_request("/login", no_email_info, test_name='no_email_login')
        test_print("test_no_username_login completed")

        # test_post_login_admin(self):
        test_print("test_post_login_admin starting")
        logininfo = {'email' : '*****@*****.**',
                     'password' : 'test'}
        compare_post_request("/login", logininfo)
        test_print("test_post_login_admin completed")
예제 #17
0
    def test_post_register(self):
        test_print("test_post_register starting")
        data = {
            'username': '******',
            'name': 'ronald',
            'affiliation': 'synbiohubtester',
            'email': '*****@*****.**',
            'password1': 'test1',
            'password2': 'test1'
        }
        compare_post_request("register",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="register1")

        logininfo = {'email': '*****@*****.**', 'password': '******'}
        login_with(logininfo)

        compare_get_request("/profile")

        data = {
            'name': 'ronnie',
            'affiliation': 'notcovid',
            'email': '*****@*****.**',
            'password1': 'test',
            'password2': 'test'
        }
        compare_post_request("profile",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="profile2")

        compare_get_request("/logout")

        test_print("test_post_register completed")

        test_print("test_post_login_token starting")
        logininfo = {'email': '*****@*****.**', 'password': '******'}
        login_with(logininfo)
        test_print("test_post_login_token completed")
예제 #18
0
    def test_edit(self):
        # test_update_mutableDescription
        test_print("test_update_mutableDescription starting")
        data = {
            'uri': 'http://localhost:7777/public/testid1/testid1_collection/1',
            'value': 'testUpdateMutableDescription'
        }
        compare_post_request("updateMutableDescription",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="test_update_mutableDescription")
        test_print("test_update_mutableDescription completed")

        # test_update_mutableNotes
        test_print("test_update_mutableNotes starting")
        data = {
            'uri': 'http://localhost:7777/public/testid1/testid1_collection/1',
            'value': 'testUpdateMutableNotes'
        }
        compare_post_request("updateMutableNotes",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="test_update_mutableNotes")
        test_print("test_update_mutableNotes completed")

        # test_update_mutableSource
        test_print("test_update_mutableSource starting")
        data = {
            'uri': 'http://localhost:7777/public/testid1/testid1_collection/1',
            'value': 'testUpdateMutableSource'
        }
        compare_post_request("updateMutableSource",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="test_update_mutableSource")
        test_print("test_update_mutableSource completed")

        # test_edit_citations
        test_print("test_edit_citations starting")
        data = {
            'uri': 'http://localhost:7777/public/testid1/testid1_collection/1',
            'value': '1234'
        }
        compare_post_request("updateCitations",
                             data,
                             headers={"Accept": "text/plain"},
                             test_name="test_edit_mutable_citations")
        test_print("test_edit_citations completed")
예제 #19
0
    def create_collection(self, collectionname, sbol2filename):
        data = {
            'id': (None, 'testid_' + collectionname),
            'version': (None, '1'),
            'name': (None, collectionname),
            'description': (None, 'testdescription'),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/" +
             sbol2filename,
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/' +
                 sbol2filename, 'rb'))
        }

        compare_post_request("submit",
                             data,
                             headers={"Accept": "text/plain"},
                             files=files,
                             test_name="create_collection_" + collectionname)
예제 #20
0
 def test_post_login_admin(self):
     logininfo = {'email' : '*****@*****.**',
                  'password' : 'test'}
     compare_post_request("/login", logininfo)
예제 #21
0
 def test_no_username_login(self):
     no_email_info = {'password' : 'test'}
     compare_post_request("/login", no_email_info, test_name='no_email_login')
예제 #22
0
 def test_post_bad_login(self):
     bad_login_info = {'email' : 'bademail',
                       'password' : 'test'}
     compare_post_request("/login", bad_login_info, test_name='bad_admin_login')
예제 #23
0
    def test_admin1(self):
        # test_admin_status(self):
        test_print("test_admin_status starting")
        compare_get_request("/admin")
        test_print("test_admin_status completed")

        # test_admin_users(self):
        test_print("test_admin_users starting")
        compare_get_request("/admin/users")
        test_print("test_admin_users completed")

        # test_admin_graphs(self):
        test_print("test_admin_graphs starting")
        compare_get_request("/admin/graphs")
        test_print("test_admin_graphs completed")

        # test_admin_remotes(self):
        test_print("test_admin_remotes starting")
        compare_get_request("/admin/remotes")
        test_print("test_admin_remotes completed")

        # test_admin_theme(self):
        test_print("test_admin_theme starting")
        compare_get_request("/admin/theme")
        test_print("test_admin_theme completed")

        # test_admin_newUser(self):
        test_print("test_admin_newUser GET starting")
        compare_get_request("/admin/newUser")
        test_print("test_admin_newUser GET  completed")

        # test_admin_sparql(self):
        test_print("test_admin_sparql starting")
        compare_get_request("/admin/sparql", headers = {"Accept": "text/html"})
        test_print("test_admin_sparql completed")

        # TODO: fix backup in docker containers
        #def test_admin_backup(self):
        #    compare_get_request("admin/backup")

        #def test_admin_log(self):
        #    compare_get_request("admin/log")

        # test_admin_mail(self):
        test_print("test_admin_mail starting")
        compare_get_request("/admin/mail")
        test_print("test_admin_mail completed")

        # test_post_admin_mail(self):
        test_print("test_post_admin_mail starting")
        data={
            'key': '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',
            'fromEmail' : '*****@*****.**',
        }
        compare_post_request("/admin/mail", data, headers = {"Accept": "text/plain"}, test_name = "admin_mail")
        test_print("test_post_admin_mail completed")

        # test_admin_savePlugin(self):
        test_print("test_admin_savePlugin starting")
        data={
            'id': 'New',
            'category' : 'download',
            'name' : 'test_plugin',
            'url' : 'jimmy',
        }
        compare_post_request("/admin/savePlugin", data, headers = {"Accept": "text/plain"}, test_name = "admin_savePlugin")
        test_print("test_admin_savePlugintatus completed")

        # test_admin_plugins(self):
        test_print("test_admin_plugins starting")
        compare_get_request("/admin/plugins")
        test_print("test_admin_plgins completed")

        # test_admin_saveRegistry(self):
        test_print("test_admin_saveRegistrytatus starting")
        data={
            'uri': 'testurl.com',
            'url' : 'testurl.com',
        }
        compare_post_request("/admin/saveRegistry", data, headers = {"Accept": "text/plain"}, test_name = "admin_saveRegistry")
        test_print("test_admin_saveRegistry completed")

        # test_admin_registries(self):
        test_print("test_admin_registries starting")
        compare_get_request("admin/registries")
        test_print("test_admin_registries completed")

        # TODO: FIGURE OUT ANOTHER WAY TO TEST THIS
        #    def test_admin_retreiveFromWebOfRegistries(self):
        #        data={
        #        }
        #        compare_post_request("/admin/retrieveFromWebOfRegistries", data, headers = {"Accept": "text/plain"}, test_name = "admin_retrieveFromWebOfRegistries")

        #    def test_admin_federate(self):
        #        data={
        #            'administratorEmail': '*****@*****.**',
        #            'webOfRegistries' : 'https://wor.synbiohub.org',
        #        }
        #        compare_post_request("/admin/federate", data, headers = {"Accept": "text/plain"}, test_name = "admin_federate")

        test_print("test_admin_setAdministratorEmail starting")
        data={
            'administratorEmail': '*****@*****.**',
        }
        compare_post_request("/admin/setAdministratorEmail", data, headers = {"Accept": "text/plain"}, test_name = "admin_setAdministratorEmail")
        test_print("test_admin_setAdministratorEmail completed")

        test_print("test_admin_updateTheme starting")
        logo = os.path.basename('./logo.jpg');
        data={
            'instanceName': 'test_instance',
            'frontPageText' : 'test_instance',
            'baseColor' : 'A32423',
            'showModuleInteractions' : 'ok',
        }
        files={
            'logo' : (logo, open('./logo.jpg', 'rb')),
        }
        compare_post_request("/admin/theme", data, headers = {"Accept": "text/plain"}, files = files, test_name = "admin_setAdministratorEmail")
        test_print("test_admin_updateTheme completed")

        test_print("test_admin_status starting")
        data={
            'useSBOLExplorer': 'True',
            'SBOLExplorerEndpoint' : 'http://*****:*****@user.synbiohub',
        #            'affiliation' : 'adminNewUser',
        #            'isMember' : '1',
        #            'isCurator' : '1',
        #            'isAdmin' : '1',
        #        }
        #        compare_post_request("/admin/newUser", data, headers = {"Accept": "text/plain"}, test_name = "admin_newUser")

        #    def test_updateUserConfig(self):
        #        data={
        #            'allowPublicSignup': 'False',
        #        }
        #        compare_post_request("/admin/users", data, headers = {"Accept": "text/plain"}, test_name = "admin_updateUsersConfig")

        # test_updateUser(self):
        test_print("test_updateUser starting")
        data={
            'id': '2',
            'name' : 'ronnieUpdated',
            'email' : '*****@*****.**',
            'affiliation' : 'updatedAffiliation',
            'isMember' : '1',
            'isCurator' : '1',
            'isAdmin' : '1'
        }
        compare_post_request("/admin/updateUser", data, headers = {"Accept": "text/plain"}, test_name = "admin_updateUser")
        test_print("test_updateUser completed")

        test_print("test_admin_newUser GET starting")
        compare_get_request("/admin/newUser", test_name = "test_new_user0")
        test_print("test_admin_newUser GET completed")


        # test_admin_deletePlugin(self):
        test_print("test_admin_deletePlugin starting")
        data={
            'id': '1',
            'category' : 'download',
        }
        compare_post_request("/admin/deletePlugin", data, headers = {"Accept": "text/plain"}, test_name = "admin_deletePlugin")
        test_print("test_admin_deletePlugin completed")

        # test_admin_deleteRegistry(self):
        test_print("test_admin_deleteRegistry starting")
        data={
            'uri': 'testurl.com',
        }
        compare_post_request("/admin/deleteRegistry", data, headers = {"Accept": "text/plain"}, test_name = "admin_deleteRegistry")
        test_print("test_admin_deleteRegistry completed")

        # test_admin_deleteRemoteBenchling(self):
        test_print("test_admin_deleteRemoteBenchling starting")
        data={
            'id': '1',
        }
        compare_post_request("/admin/deleteRemote", data, headers = {"Accept": "text/plain"}, test_name = "admin_deleteRemoteBenchling")
        test_print("test_admin_deleteRemoteBenchling completed")

        # test_admin_deleteRemoteICE(self):
        test_print("test_admin_deleteRemoteICE starting")
        data={
            'id': 'test',
        }
        compare_post_request("/admin/deleteRemote", data, headers = {"Accept": "text/plain"}, test_name = "admin_deleteRemoteICE")
        test_print("test_admin_deleteRemoteICE completed")

        # test_admin_DeleteUser(self):
        test_print("test_admin_DeleteUser starting")
        data={
            'id': '2',
        }
        compare_post_request("/admin/deleteUser", data, headers = {"Accept": "text/plain"}, test_name = "admin_deleteUser")
        test_print("test_admin_DeleteUser completed")

        # test_newUser(self):
        test_print("test_newUser POST starting")
        data = {
            'username': '******',
            'name' : 'adminNewUser',
            'email' : '*****@*****.**',
            'affiliation' : 'adminNewUser',
            'isMember' : '1',
            'isCurator' : '1',
            'isAdmin' : '1',
        }
        compare_post_request("/admin/newUser", data, headers = {"Accept": "text/plain"}, test_name = "admin_newUser1")
        test_print("test_newUser POST completed")
예제 #24
0
    def test_submit(self):
        test_print("test_main_page starting")
        headers = {'Accept': 'text/plain'}
        compare_get_request("/",
                            test_name="after_admin_login",
                            headers=headers)

        test_print("test_main_page completed")

        test_print("test_get_submit_submissions_empty starting")
        compare_get_request("submit")
        compare_get_request("manage")

        # working curl request
        #curl -X POST -H "Accept: text/plain" -H "X-authorization: e35054aa-04e3-425c-afd2-66cb95ff66e1" -F id=green -F version="3" -F name="test" -F description="testd" -F citations="none" -F overwrite_merge="0" -F file=@"./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml" http://localhost:7777/submit"""

        test_print("test_get_submit_submissions_empty completed")

        test_print("test_create_id_missing starting")

        data = {
            'version': (None, '1'),
            'name': (None, 'testcollection'),
            'description': (None, 'testdescription'),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml',
                 'rb'))
        }
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_post_request("submit",
                                 data,
                                 headers={"Accept": "text/plain"},
                                 files=files,
                                 test_name="missing_id")

        test_print("test_create_id_missing completed")

        test_print("test_create_and_delete_collections starting")
        # create the collection
        data = {
            'id': (None, 'testid'),
            'version': (None, '1'),
            'name': (None, 'testcollection'),
            'description': (None, 'testdescription'),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml',
                 'rb'))
        }

        compare_post_request("submit",
                             data,
                             headers={"Accept": "text/plain"},
                             files=files,
                             test_name="submit_test_BBa")
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_post_request("submit",
                                 data,
                                 headers={"Accept": "text/plain"},
                                 files=files,
                                 test_name="submit_already_in_use")

#        self.create_collection2()

        compare_get_request("manage", test_name="two_submissions")
        compare_get_request("submit", test_name="two_submissions")

        # now remove the collections
        compare_get_request(
            '/user/:userId/:collectionId/:displayId/:version/removeCollection',
            route_parameters=["testuser", "testid", "testid_collection", "1"])
        compare_get_request(
            '/user/:userId/:collectionId/:displayId/:version/removeCollection',
            route_parameters=[
                "testuser", "testid2", "testid2_collection", "1"
            ],
            test_name='remove_second')

        compare_get_request("manage", test_name="no_submissions")

        test_print("test_create_and_delete_collections completed")

        test_print("create_collection2 starting")
        data = {
            'id': (None, 'testid2'),
            'version': (None, '1'),
            'name': (None, 'testcollection2'),
            'description': (None, 'testdescription'),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml",
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/BBa_I0462.xml',
                 'rb'))
        }

        compare_post_request("submit",
                             data,
                             headers={"Accept": "text/plain"},
                             files=files,
                             test_name="create_2")

        # delete collection
        #compare_get_request("/user/testuser/testid2/testid_collection2/1/removeCollection")

        test_print("create_collection2 completed")

        test_print("make_new_collection starting")
        # create the collection
        data = {
            'id': (None, 'testid1'),
            'version': (None, '1'),
            'name': (None, 'testcollection1'),
            'description': (None, 'testdescription1'),
            'citations': (None, 'none'),
            'overwrite_merge': (None, '0')
        }

        files = {
            'file':
            ("./SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/toggle.xml",
             open(
                 './SBOLTestRunner/src/main/resources/SBOLTestSuite/SBOL2/toggle.xml',
                 'rb'))
        }

        compare_post_request("submit",
                             data,
                             headers={"Accept": "text/plain"},
                             files=files,
                             test_name="generic_collection1")

        test_print("make_new_collection completed")

        #    """ def test_bad_make_public(self):
        #        data = self.make_new_collection("1")
        #
        #        data['tabState'] = 'new'
        #
        #        # try to remove the collection but don't enter a id
        #        del data['id']
        #        with self.assertRaises(requests.exceptions.HTTPError):
        #            compare_post_request("/user/:userId/:collectionId/:displayId/:version/makePublic", route_parameters = ["testuser", "testid1", "testid_collection1", "1"], data = data)
        #    TODO: uncomment when this does raise an HTTPError in synbiohub
        #        """

        test_print("test_make_public starting")

        # get the view
        compare_get_request(
            "/user/:userId/:collectionId/:displayId/:version/makePublic",
            route_parameters=[
                "testuser", "testid0", "testid0_collection", "1"
            ])

        data['tabState'] = 'new'

        # make the collection public
        compare_post_request(
            "/user/:userId/:collectionId/:displayId/:version/makePublic",
            route_parameters=[
                "testuser", "testid1", "testid1_collection", "1"
            ],
            data=data)

        # try to delete the collection
        with self.assertRaises(requests.exceptions.HTTPError):
            compare_get_request(
                "/public/:collectionId/:displayId/:version/removeCollection",
                route_parameters=["testid1", "testid1_collection", "1"],
                test_name='remove')

        test_print("test_make_public completed")