def post_(db):
    usernick = session_user(db)
    company = request.forms.get('company')
    title = request.forms.get('title')
    location = request.forms.get('location')
    description = request.forms.get('description')
    position_add(db, usernick, title, location, company, description)
    redirect("/")
def post(db):
    name = users.session_user(db)
    title = request.forms.get('title')
    location = request.forms.get('location')
    company = request.forms.get('company')
    description = request.forms.get('description')

    interface.position_add(db, name, title, location, company, description)
    redirect('/')
Exemple #3
0
def add_database(db):
    """Logged in user can add new positions
    using position_add() from interface.py to add positions"""
    usernick = users.session_user(db)
    title = request.query.title
    location = request.query.location
    company = request.query.company
    description = request.query.description
    interface.position_add(db, usernick, title, location, company, description)
    redirect('/')
def post_job(db):
    # Method to persist job. Method handles form request from "/post" and then extracts individual components
    # Calls position_add method from interface module to persist it to the db

    title= request.forms.get("title")
    company = request.forms.get("company")
    location = request.forms.get("location")
    description = request.forms.get("description")
    active_user = users.session_user(db)
    interface.position_add(db,active_user,title,location,company,description)
    redirect("/") # Redirecting to the index page
def post_job(db):
    """Save the new job details entered by user in the positions table"""

    #get post parameter
    username = users.session_user(db)
    position = request.forms.get("title")
    location = request.forms.get("location")
    company = request.forms.get("company")
    description = request.forms.get("description")

    #insert data into positions table
    interface.position_add(db, username, position, location, company,
                           description)

    #reset error message
    info['message'] = ''
    return redirect("/")
Exemple #6
0
    def test_position_add_bad_usernick(self):
        """Test adding new positions"""

        usernick = 'Nonexistant'
        title = "Sample Job Ad"
        location = "Sydney"
        company = "ACME Widgets"
        description = "This is the description"

        # get an initial count of positions
        positioncount = len(interface.position_list(self.db, limit=1000))

        result = interface.position_add(self.db, usernick, title, location, company, description)

        # should have returned False because the user nick does not exist
        self.assertFalse(result)

        # should have the same number of positions
        positions = interface.position_list(self.db, limit=1000)
        self.assertEqual(positioncount, len(positions))
Exemple #7
0
    def test_position_add(self):
        """Test adding new positions"""

        usernick = 'Bean'
        title = "Sample Job Ad"
        location = "Sydney"
        company = "ACME Widgets"
        description = "This is the description"

        # get an initial count of positions
        positioncount = len(interface.position_list(self.db, limit=1000))

        result = interface.position_add(self.db, usernick, title, location, company, description)

        # should have returned True for succesful insertion
        self.assertTrue(result)

        # should now have one more position
        positions = interface.position_list(self.db, limit=1000)
        self.assertEqual(1, len(positions)-positioncount)

        # check the latest one is the one we added
        self.assertEqual(title, positions[0][3])