예제 #1
0
def test_update_sku():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(
        associated_codes=[], id='SKU000000', name='', owned_codes=[],
        props={}))
    state.update_sku(patch={}, sku_id=v1)
    state.teardown()
예제 #2
0
def test_delete_sku():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(associated_codes=[],
                               id='SKU000000',
                               name='',
                               owned_codes=[],
                               props=None))
    state.delete_unused_sku(sku_id=v1)
    state.teardown()
예제 #3
0
def test_move_sku(data):
    state = InventoryStateMachine()
    v1 = state.new_bin(bin=Bin(contents={}, id='BIN000000', props=None))
    v2 = state.new_bin(bin=Bin(contents={}, id='BIN000001', props=None))
    v3 = state.new_sku(sku=Sku(id='SKU000000'))
    state.receive_sku(bin_id=v1, sku_id=v3, quantity=1)
    state.move(data=data, destination_binId=v2, source_binId=v1)
    state.get_existing_bin(bin_id=v1)
    state.get_existing_bin(bin_id=v2)
    state.teardown()
예제 #4
0
def test_delete_used_sku():
    state = InventoryStateMachine()
    v1 = state.new_bin(bin=Bin(contents={}, id='BIN000000', props=None))
    v2 = state.new_sku(sku=Sku(associated_codes=[],
                               id='SKU000000',
                               name='',
                               owned_codes=[],
                               props=None))
    state.receive_sku(bin_id=v1, quantity=1, sku_id=v2)
    state.attempt_delete_used_sku(sku_id=v2)
    state.teardown()
예제 #5
0
def test_change_batch_sku():
    state = InventoryStateMachine()
    sku0 = state.new_sku(sku=Sku(id='SKU000000', name=''))
    sku1 = state.new_sku(sku=Sku(id='SKU000001', name=''))

    data = dst.DataProxy(Batch(id='BAT000000', sku_id=sku0))
    batch0 = state.new_batch_existing_sku(data=data, sku_id=sku0)

    state.attempt_update_nonanonymous_batch_sku_id(batch_id=batch0,
                                                   patch={},
                                                   sku_id=sku1)
    state.teardown()
예제 #6
0
def test_new_batch_bad_format_owned_codes():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(
        associated_codes=[], id='SKU000000', name='', owned_codes=[],
        props={}))
    data = dst.DataProxy(
        Batch(associated_codes=[],
              id='BAT000000',
              name='',
              owned_codes=[],
              props={},
              sku_id='SKU000000'))
    state.new_batch_bad_format_owned_codes(bad_code='', data=data, sku_id=v1)
    state.teardown()
예제 #7
0
def test_update_batch_existing_sku():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(
        associated_codes=[], id='SKU000000', name='', owned_codes=[],
        props={}))
    data = dst.DataProxy(
        Batch(associated_codes=[],
              id='BAT000000',
              name='',
              owned_codes=[],
              props={},
              sku_id='SKU000000'))
    v2 = state.new_batch_existing_sku(data=data, sku_id=v1)
    state.update_batch(batch_id=v2, patch={})
    state.teardown()
예제 #8
0
def test_update_sku_batch():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(associated_codes=[],
                               id='SKU000001',
                               name='',
                               owned_codes=[],
                               props=None))
    v2 = state.new_sku(sku=Sku(associated_codes=[],
                               id='SKU000002',
                               name='',
                               owned_codes=[],
                               props=None))
    # state.delete_missing_sku(sku_id='SKU000000')
    data = dst.DataProxy(
        Batch(associated_codes=[],
              id='BAT000000',
              owned_codes=[],
              props={0: 0},
              sku_id='SKU000001'))
    v2 = state.new_batch_existing_sku(data=data, sku_id=v1)
    state.attempt_update_nonanonymous_batch_sku_id(batch_id=v2,
                                                   patch={},
                                                   sku_id='SKU000002')
    state.teardown()
예제 #9
0
def test_add_sku_to_anonymous_batch():
    state = InventoryStateMachine()
    v1 = state.new_sku(sku=Sku(associated_codes=[],
                               id='SKU000000',
                               name='',
                               owned_codes=[],
                               props=None))
    v2 = state.new_anonymous_batch(batch=Batch(associated_codes=[],
                                               id='BAT000000',
                                               owned_codes=[],
                                               props=None,
                                               sku_id=None))
    state.update_anonymous_batch_existing_sku_id(batch_id=v2,
                                                 patch={},
                                                 sku_id=v1)
    state.teardown()