(user_details)
| 1772 | |
| 1773 | |
| 1774 | def create_user(user_details): |
| 1775 | try: |
| 1776 | conn = sqlite3.connect(config.TEST_SQLITE_PATH) |
| 1777 | # Create the server |
| 1778 | cur = conn.cursor() |
| 1779 | user_details = ( |
| 1780 | user_details['login_username'], user_details['login_username'], |
| 1781 | user_details['login_password'], 1, uuid.uuid4().hex) |
| 1782 | |
| 1783 | cur.execute( |
| 1784 | 'select * from user where username = "%s"' % user_details[0]) |
| 1785 | user = cur.fetchone() |
| 1786 | if user is None: |
| 1787 | cur.execute('INSERT INTO user (username, email, password, active,' |
| 1788 | ' fs_uniquifier) VALUES (?,?,?,?,?)', user_details) |
| 1789 | user_id = cur.lastrowid |
| 1790 | conn.commit() |
| 1791 | else: |
| 1792 | user_id = user[0] |
| 1793 | conn.close() |
| 1794 | |
| 1795 | return user_id |
| 1796 | except Exception as exception: |
| 1797 | traceback.print_exc(file=sys.stderr) |
| 1798 | raise "Error while creating server. %s" % exception |
| 1799 | |
| 1800 | |
| 1801 | def get_test_user(self, user_details, |
no test coverage detected