def test_get(self): base_url = '/study/sharing/autocomplete/?text=%s' r_client.zadd('qiita-usernames', {e: 0 for e, n in User.iter()}) response = self.get(base_url % 't') self.assertEqual(response.code, 200) self.assertEqual( loads(response.body), {'results': [{ "id": "*****@*****.**", "text": "*****@*****.**" }]}) response = self.get(base_url % 'admi') self.assertEqual(response.code, 200) self.assertEqual( loads(response.body), {'results': [{ "id": "*****@*****.**", "text": "*****@*****.**" }]}) response = self.get(base_url % 'tesq') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': []}) r_client.delete('qiita-usernames')
def test_get(self): # Create the usernames key so we can do autocomplete r_client.zadd('qiita-usernames', **{u: 0 for u in User.iter()}) response = self.get(self.base_url % 't') self.assertEqual(response.code, 200) self.assertEqual( loads(response.body), {'results': [{ "id": "*****@*****.**", "text": "*****@*****.**" }]}) response = self.get(self.base_url % 'admi') self.assertEqual(response.code, 200) self.assertEqual( loads(response.body), {'results': [{ "id": "*****@*****.**", "text": "*****@*****.**" }]}) response = self.get(self.base_url % 'tesq') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': []}) r_client.delete('qiita-usernames')
def test_get(self): # Create the usernames key so we can do autocomplete r_client.zadd('qiita-usernames', **{e: 0 for e, n in User.iter()}) response = self.get(self.base_url % 't') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': [{"id": "*****@*****.**", "text": "*****@*****.**"}]}) response = self.get(self.base_url % 'admi') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': [{"id": "*****@*****.**", "text": "*****@*****.**"}]}) response = self.get(self.base_url % 'tesq') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': []}) r_client.delete('qiita-usernames')
def get(self, code): email = self.get_argument("email").strip().lower() code_is_valid = False msg = "This code is not valid." # an exception is raised if the 'code type' is not available, otherwise # the method determines the validity of the code try: code_is_valid = User.verify_code(email, code, "create") except QiitaDBError: msg = "This user has already created an account." if code_is_valid: msg = "Successfully verified user. You are now free to log in." color = "black" r_client.zadd('qiita-usernames', email, 0) else: color = "red" self.render("user_verified.html", msg=msg, color=color, email=self.get_argument("email").strip())
def test_get(self): base_url = '/study/sharing/autocomplete/?text=%s' r_client.zadd('qiita-usernames', {e: 0 for e, n in User.iter()}) response = self.get(base_url % 't') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': [{"id": "*****@*****.**", "text": "*****@*****.**"}]}) response = self.get(base_url % 'admi') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': [{"id": "*****@*****.**", "text": "*****@*****.**"}]}) response = self.get(base_url % 'tesq') self.assertEqual(response.code, 200) self.assertEqual(loads(response.body), {'results': []}) r_client.delete('qiita-usernames')
from qiita_db.util import convert_to_id # one of the main side issues raised by #2901 is that new users emails were not # added to the redis database that keep track of emails and is used to # autocomplete when sharing a study. In the next look we will find all `Users` # in the `user` level, search them in the redis database, and keep those ones # that are not found missing_emails = [u[0] for u in User.iter() if User(u[0]).level == 'user' and not r_client.execute_command( 'zrangebylex', 'qiita-usernames', '[%s' % u[0], u'[%s\xff' % u[0])] # now just add them for email in missing_emails: r_client.zadd('qiita-usernames', {email: 0}) # adding new internal command for INSDC download # note that create_command is a method that has been used in previous patches def create_command(software, name, description, parameters, outputs=None, analysis_only=False): r"""Replicates the Command.create code at the time the patch was written""" # Perform some sanity checks in the parameters dictionary if not parameters: raise QiitaDBError( "Error creating command %s. At least one parameter should " "be provided." % name) sql_param_values = [] sql_artifact_params = [] for pname, vals in parameters.items():