
from byceps.services.shop.order.models.order import PaymentState

from testfixtures.shop_order import create_order
from testfixtures.user import create_user


def test_is_open():
    payment_state = PaymentState.open

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == True
    assert order.is_canceled == False
    assert order.is_paid == False


def test_is_open():
    payment_state = PaymentState.canceled

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == True
    assert order.is_paid == False


def test_is_open():
    payment_state = PaymentState.paid

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == False
    assert order.is_paid == True


# helpers

def create_order_with_payment_state(payment_state):
    user = create_user(42)

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)
    order.payment_state = payment_state

    return order


from byceps.services.shop.order.models.order import PaymentState

from testfixtures.shop_order import create_order
from testfixtures.user import create_user


def test_is_open():
    payment_state = PaymentState.open

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == True
    assert order.is_canceled == False
    assert order.is_paid == False


def test_is_canceled():
    payment_state = PaymentState.canceled

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == True
    assert order.is_paid == False


def test_is_paid():
    payment_state = PaymentState.paid

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == False
    assert order.is_paid == True


# helpers

def create_order_with_payment_state(payment_state):
    user = create_user(42)

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)
    order.payment_state = payment_state

    return order

Fix overshadowed tests by giving test functions unique names
Fix overshadowed tests by giving test functions unique names

  
  from byceps.services.shop.order.models.order import PaymentState
  
  from testfixtures.shop_order import create_order
  from testfixtures.user import create_user
  
  
  def test_is_open():
      payment_state = PaymentState.open
  
      order = create_order_with_payment_state(payment_state)
  
      assert order.payment_state == payment_state
      assert order.is_open == True
      assert order.is_canceled == False
      assert order.is_paid == False
  
  
- def test_is_open():
+ def test_is_canceled():
      payment_state = PaymentState.canceled
  
      order = create_order_with_payment_state(payment_state)
  
      assert order.payment_state == payment_state
      assert order.is_open == False
      assert order.is_canceled == True
      assert order.is_paid == False
  
  
- def test_is_open():
+ def test_is_paid():
      payment_state = PaymentState.paid
  
      order = create_order_with_payment_state(payment_state)
  
      assert order.payment_state == payment_state
      assert order.is_open == False
      assert order.is_canceled == False
      assert order.is_paid == True
  
  
  # helpers
  
  def create_order_with_payment_state(payment_state):
      user = create_user(42)
  
      party_id = 'acme-party-2016'
      placed_by = user
  
      order = create_order(party_id, placed_by)
      order.payment_state = payment_state
  
      return order
  
Fix overshadowed tests by giving test functions unique names
## Code Before:

from byceps.services.shop.order.models.order import PaymentState

from testfixtures.shop_order import create_order
from testfixtures.user import create_user


def test_is_open():
    payment_state = PaymentState.open

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == True
    assert order.is_canceled == False
    assert order.is_paid == False


def test_is_open():
    payment_state = PaymentState.canceled

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == True
    assert order.is_paid == False


def test_is_open():
    payment_state = PaymentState.paid

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == False
    assert order.is_paid == True


# helpers

def create_order_with_payment_state(payment_state):
    user = create_user(42)

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)
    order.payment_state = payment_state

    return order

## Instruction:
Fix overshadowed tests by giving test functions unique names
## Code After:

from byceps.services.shop.order.models.order import PaymentState

from testfixtures.shop_order import create_order
from testfixtures.user import create_user


def test_is_open():
    payment_state = PaymentState.open

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == True
    assert order.is_canceled == False
    assert order.is_paid == False


def test_is_canceled():
    payment_state = PaymentState.canceled

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == True
    assert order.is_paid == False


def test_is_paid():
    payment_state = PaymentState.paid

    order = create_order_with_payment_state(payment_state)

    assert order.payment_state == payment_state
    assert order.is_open == False
    assert order.is_canceled == False
    assert order.is_paid == True


# helpers

def create_order_with_payment_state(payment_state):
    user = create_user(42)

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)
    order.payment_state = payment_state

    return order
