from behave import given, when, then
from hamcrest import assert_that, contains, not_none, none, equal_to
from coolio import cli
from click.testing import CliRunner
import os.path

results = []

@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, "../resources/" + text)

    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, "../resources/" + text)

    context.movies_path = path

@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path, context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print("EXPECTED MATCH ON: %s, result: %s" % (expected, context.result))
    assert_that(match, equal_to(True))


@then('this "{expected}" should not be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print("EXPECTED NO MATCH ON: %s, result: %s" % (expected, context.result))

    assert_that(match, equal_to(False))


153347e4e6258c0860d9fa728211edeea5b6967c
<mask token>


@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.movies_path = path


@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path,
            context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED MATCH ON: %s, result: %s' % (expected, context.result))
    assert_that(match, equal_to(True))


<mask token>

<mask token>


@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.movies_path = path


@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path,
            context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED MATCH ON: %s, result: %s' % (expected, context.result))
    assert_that(match, equal_to(True))


@then('this "{expected}" should not be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED NO MATCH ON: %s, result: %s' % (expected, context.
            result))
    assert_that(match, equal_to(False))

<mask token>
results = []


@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.movies_path = path


@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path,
            context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED MATCH ON: %s, result: %s' % (expected, context.result))
    assert_that(match, equal_to(True))


@then('this "{expected}" should not be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED NO MATCH ON: %s, result: %s' % (expected, context.
            result))
    assert_that(match, equal_to(False))

from behave import given, when, then
from hamcrest import assert_that, contains, not_none, none, equal_to
from coolio import cli
from click.testing import CliRunner
import os.path
results = []


@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, '../resources/' + text)
    context.movies_path = path


@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path,
            context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED MATCH ON: %s, result: %s' % (expected, context.result))
    assert_that(match, equal_to(True))


@then('this "{expected}" should not be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print('EXPECTED NO MATCH ON: %s, result: %s' % (expected, context.
            result))
    assert_that(match, equal_to(False))

from behave import given, when, then
from hamcrest import assert_that, contains, not_none, none, equal_to
from coolio import cli
from click.testing import CliRunner
import os.path

results = []

@given('{text} as watchlist')
def given_watchlist_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, "../resources/" + text)

    context.watchlist_path = path


@given('{text} as movielist')
def given_available_data(context, text):
    my_path = os.path.abspath(os.path.dirname(__file__))
    path = os.path.join(my_path, "../resources/" + text)

    context.movies_path = path

@when('comparing')
def compare(context):
    runner = CliRunner()
    if not results:
        result = runner.invoke(cli, ['compare', context.movies_path, context.watchlist_path])
        results.extend(result.output.split('\n'))
    context.result = results


@then('this "{expected}" should be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print("EXPECTED MATCH ON: %s, result: %s" % (expected, context.result))
    assert_that(match, equal_to(True))


@then('this "{expected}" should not be in the result')
def movies_should_be_in_result(context, expected):
    match = expected.upper() in map(str.upper, context.result)
    if not match:
        print("EXPECTED NO MATCH ON: %s, result: %s" % (expected, context.result))

    assert_that(match, equal_to(False))

