diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dac2128..df23688 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,5 +6,9 @@ jobs: steps: - name: check out repository uses: actions/checkout@v4 - - name: test - run: docker build . + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest + - name: Test with pytest + run: python -m pytest --doctest-modules diff --git a/Dockerfile b/Dockerfile index b84b180..c493c80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,3 @@ WORKDIR /app RUN python3 -m pip install --upgrade pip RUN python3 -m pip install rfc1924 -RUN python3 ./rfc1924/test_rfc1924.py diff --git a/rfc1924/test_rfc1924.py b/rfc1924/test_rfc1924.py deleted file mode 100644 index 697e2b9..0000000 --- a/rfc1924/test_rfc1924.py +++ /dev/null @@ -1,6 +0,0 @@ -from rfc1924 import * - -assert encode("2345:425:2ca1::567:5673:23b5") == "AN?6(i3Y+yVr74uX@J3P" -assert decode("AN?6(i3Y+yVr74uX@J3P") == "2345:425:2ca1::567:5673:23b5" - -print(savings("2345:425:2ca1::567:5673:23b5")) diff --git a/rfc1924/tests/test_rfc1924.py b/rfc1924/tests/test_rfc1924.py new file mode 100644 index 0000000..e58e38b --- /dev/null +++ b/rfc1924/tests/test_rfc1924.py @@ -0,0 +1,11 @@ +from rfc1924 import * +import pytest + +def test_encode(): + assert encode("2345:425:2ca1::567:5673:23b5") == "AN?6(i3Y+yVr74uX@J3P" + +def test_decode(): + assert decode("AN?6(i3Y+yVr74uX@J3P") == "2345:425:2ca1::567:5673:23b5" + +def test_savings(): + assert (savings("2345:425:2ca1::567:5673:23b5") == 'You saved 28%') \ No newline at end of file