Skip to content

Commit

Permalink
testing pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
Euan Campbell committed Jun 16, 2021
1 parent e5dcf8a commit 3d9778d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions octopus_energy_api/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from octopus_energy_api import oe_api
import os

api_key = ""
account_number = ""
api_key = os.environ.get('API_KEY')
account_number = os.environ.get('ACCOUNT_NUMBER')

# account_details = oe_api.get_mpan_serial(account_number, api_key)

Expand Down
4 changes: 0 additions & 4 deletions octopus_energy_api/octopus_energy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ def __init__(self, account_number, api_key, mpan=None, serial_number=None):

self.account_number=account_number

print('here')
print(account_number)
print(api_key)

if not mpan and not serial_number:
account_details = self.get_mpan_serial(account_number, api_key)

Expand Down
11 changes: 7 additions & 4 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from octopus_energy_api import oe_api
import os
import sys

print('sys args...')
print(sys.argv)

# load from environment variables
api_key = os.environ.get('API_KEY')
Expand All @@ -9,13 +13,12 @@


def test_account_details():

expected_output = '2020-11-19T00:00:00Z'
expected_output = '020-11-19T00:00:00Z'

output = energy_api.account_details()['properties'][0]['moved_in_at']

random=sys.argv[1]
if output != expected_output:
raise Exception(f"expected {expected_output}, got {output}.")
raise Exception(f"expected {expected_output}, got {output}. Random: {random}.")



Expand Down

0 comments on commit 3d9778d

Please sign in to comment.