Пример #1
0
def test_updateSession(
  dynamo_client, table_init, table_name, visitor, browsers, visits, session,
):
  client = DynamoClient( table_name )
  client.addNewSession( visitor, browsers, visits )
  client.addSession( session )
  result = client.updateSession( session, visits )
  assert 'visits' in result.keys()
  assert all( [
    dict( result['visits'][index] ) == dict(visits[index])
    for index in range( len( visits ) )
  ] )
  assert 'session' in result.keys()
  assert dict( result['session'] ) == dict( session )
Пример #2
0
def test_getSessionDetails(dynamo_client, table_init, table_name, visitor,
                           browsers, visits, session):
    client = DynamoClient(table_name)
    client.addVisitor(visitor)
    client.addNewSession(visitor, browsers, visits)
    result = client.getSessionDetails(session)
    assert 'visits' in result.keys()
    assert all([
        dict(result['visits'][index]) == dict(visits[index])
        for index in range(len(visits))
    ])
    assert 'session' in result.keys()
    assert result['session'].ip == visitor.ip
    assert result['session'].sessionStart == visits[0].date
Пример #3
0
def test_visitor_addNewSession(
  dynamo_client, table_init, table_name, visitor, browsers, visits
):
  client = DynamoClient( table_name )
  result = client.addNewSession(
    visitor, browsers, visits
  )
  assert 'error' in result.keys()
  assert result['error'] == 'Visitor not in table'
Пример #4
0
def test_addNewSession(dynamo_client, table_init, table_name, visitor,
                       browsers, visits):
    client = DynamoClient(table_name)
    client.addVisitor(visitor)
    result = client.addNewSession(visitor, browsers, visits)
    assert 'visitor' in result.keys()
    assert result['visitor'] == visitor
    assert 'browsers' in result.keys()
    assert result['browsers'] == browsers
    assert 'visits' in result.keys()
    assert result['visits'] == visits
    assert 'session' in result.keys()
    assert result['session'].ip == visitor.ip
    assert result['session'].sessionStart == visits[0].date