Exemplo n.º 1
0
 def test_registration(self):
     with self.app.app_context():
         x = register_user('*****@*****.**', 'sdf', 'sdf')
         assert x["success"] is True
         x = register_user('*****@*****.**', 'sdf', 'sdf')
         assert x["success"] is False
         x = register_user('sdf@ ssdf @s.com', 'sdf', 'sdf')
         assert x["success"] is False
Exemplo n.º 2
0
def mscolab_register_and_login(app, msc_url, email, password, username):
    register_user(email, password, username)
    data = {
        'email': email,
        'password': password
    }
    url = url_join(msc_url, 'token')
    response = app.test_client().post(url, data=data)
    return response
Exemplo n.º 3
0
 def test_register_user(self):
     with self.app.app_context():
         assert server.register_user('*****@*****.**', 'abcdef', '*****@*****.**') == \
                {'message': 'Oh no, your username cannot contain @ symbol!', 'success': False}
         assert server.register_user('*****@*****.**', 'abcdef', 'alpha') == {"success": True}
         assert server.register_user('*****@*****.**', 'abcdef', 'alpha') == \
                {'message': 'Oh no, this email ID is already taken!', 'success': False}
         assert server.register_user('*****@*****.**', 'abcdef', 'alpha') == \
                {'message': 'Oh no, this username is already registered', 'success': False}
Exemplo n.º 4
0
 def setup(self):
     self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(
         PORTS)
     QtTest.QTest.qWait(100)
     self.application = QtWidgets.QApplication(sys.argv)
     self.window = MSSMscolabWindow(
         data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
         mscolab_server_url=self.url)
     with self.app.app_context():
         register_user('*****@*****.**', 'sdf', 'sdf')
         self.user = User.query.filter_by(emailid="*****@*****.**").first()
Exemplo n.º 5
0
 def teardown(self):
     with self.app.app_context():
         mscolab_delete_all_projects(self.app, MSCOLAB_URL_TEST, '*****@*****.**', 'abcdef', 'alpha')
         mscolab_delete_all_projects(self.app, MSCOLAB_URL_TEST, '*****@*****.**', 'user', 'user')
         for em, pw in [('*****@*****.**', 'abcdef'),
                        ('*****@*****.**', 'user2'),
                        ('*****@*****.**', 'abcdef'),
                        ('*****@*****.**', 'other'),
                        ('*****@*****.**', 'user')
                        ]:
             server.register_user(em, pw, 'test')
             mscolab_delete_user(self.app, MSCOLAB_URL_TEST, em, pw)
         server.db.session.commit()
Exemplo n.º 6
0
 def test_register_user(self):
     with self.app.test_client():
         result = register_user(self.userdata[0], self.userdata[1],
                                self.userdata[2])
         assert result["success"] is True
         result = register_user(self.userdata[0], self.userdata[1],
                                self.userdata[2])
         assert result["success"] is False
         assert result[
             "message"] == "Oh no, this email ID is already taken!"
         result = register_user("UV", self.userdata[1], self.userdata[2])
         assert result["success"] is False
         assert result["message"] == "Oh no, your email ID is not valid!"
         result = register_user(self.userdata[0], self.userdata[1],
                                self.userdata[0])
         assert result["success"] is False
         assert result[
             "message"] == "Oh no, your username cannot contain @ symbol!"
Exemplo n.º 7
0
 def test_check_login(self):
     with self.app.test_client():
         result = register_user(self.userdata[0], self.userdata[1],
                                self.userdata[2])
         assert result["success"] is True
         result = check_login(self.userdata[0], self.userdata[1])
         user = User.query.filter_by(emailid=str(self.userdata[0])).first()
         assert user is not None
         assert result == user
         result = check_login('UV20@uv20', self.userdata[1])
         assert result is False