old_contents: import shelve
  
  
  def test_shows_player_rating(browser, test_server, database_url):
      with shelve.open(database_url) as db:
          db.clear()
          db['p1'] = 1000
  
      app = ScoringApp(browser, test_server)
      app.visit('/')
      app.shows('P1 1000')
  
  
  def test_user_adding(browser, test_server):
      app = ScoringApp(browser, test_server)
      app.visit('/players')
      app.add_player('test')
      app.is_in_page('/players/test')
      app.shows('TEST 1000')
  
  
  class ScoringApp(object):
      def __init__(self, browser, get_url):
          self._browser = browser
          self._get_url = get_url
  
      def visit(self, url):
          self._browser.visit(self._get_url(url))
  
      def shows(self, text):
          assert self._browser.is_text_present(text)
  
      def add_player(self, name):
          self._browser.fill('player-name', name)
          self._browser.find_by_id('submit').click()
  
      def is_in_page(self, url):
          assert self._browser.url == self._get_url(url)
  
new_contents: import shelve
  
  from whatsmyrank.players import START_RANK
  from whatsmyrank.players import PlayerRepository
  
  
  def test_shows_player_rating(browser, test_server, database_url):
      player_repo = PlayerRepository(database_url, START_RANK)
      player_repo.create('p1')
  
      app = ScoringApp(browser, test_server)
      app.visit('/')
      app.shows('P1 1000')
  
  
  def test_user_adding(browser, test_server):
      app = ScoringApp(browser, test_server)
      app.visit('/players')
      app.add_player('test')
      app.is_in_page('/players/test')
      app.shows('TEST 1000')
  
  
  class ScoringApp(object):
      def __init__(self, browser, get_url):
          self._browser = browser
          self._get_url = get_url
  
      def visit(self, url):
          self._browser.visit(self._get_url(url))
  
      def shows(self, text):
          assert self._browser.is_text_present(text)
  
      def add_player(self, name):
          self._browser.fill('player-name', name)
          self._browser.find_by_id('submit').click()
  
      def is_in_page(self, url):
          assert self._browser.url == self._get_url(url)
  
subject: Remove database details from acceptance test